diff options
| author | Adam <Adam@anope.org> | 2016-07-28 21:29:35 -0400 |
|---|---|---|
| committer | Adam <Adam@anope.org> | 2016-07-28 21:29:35 -0400 |
| commit | 0e758a2ac23dc4a001e8e126cec14588da9a9769 (patch) | |
| tree | 45df813323e023c5c89db7279426c4ad0943b4a9 /include/modules/nickserv | |
| parent | a3c8afae00c54d5b95c620248b51f90679d7d53f (diff) | |
Allow serializable fields to use storage in the respective objects.
Split service management code nito a proper servicemanager. Make service
references managed instead of lazy lookup. Also made events and
serializable use service manager instead of their respective systems for
management
Diffstat (limited to 'include/modules/nickserv')
| -rw-r--r-- | include/modules/nickserv/access.h | 5 | ||||
| -rw-r--r-- | include/modules/nickserv/ajoin.h | 6 | ||||
| -rw-r--r-- | include/modules/nickserv/cert.h | 16 | ||||
| -rw-r--r-- | include/modules/nickserv/drop.h | 6 | ||||
| -rw-r--r-- | include/modules/nickserv/group.h | 5 | ||||
| -rw-r--r-- | include/modules/nickserv/info.h | 5 | ||||
| -rw-r--r-- | include/modules/nickserv/set.h | 6 | ||||
| -rw-r--r-- | include/modules/nickserv/set_misc.h | 6 | ||||
| -rw-r--r-- | include/modules/nickserv/suspend.h | 15 | ||||
| -rw-r--r-- | include/modules/nickserv/update.h | 5 |
10 files changed, 49 insertions, 26 deletions
diff --git a/include/modules/nickserv/access.h b/include/modules/nickserv/access.h index 73a625f3d..716b22927 100644 --- a/include/modules/nickserv/access.h +++ b/include/modules/nickserv/access.h @@ -1,6 +1,6 @@ /* * - * (C) 2003-2014 Anope Team + * (C) 2003-2016 Anope Team * Contact us at team@anope.org * * Please read COPYING and README for further details. @@ -9,6 +9,8 @@ class NickAccess : public Serialize::Object { public: + static constexpr const char *const NAME = "nsaccess"; + using Serialize::Object::Object; virtual NickServ::Account *GetAccount() anope_abstract; @@ -18,5 +20,4 @@ class NickAccess : public Serialize::Object virtual void SetMask(const Anope::string &) anope_abstract; }; -static Serialize::TypeReference<NickAccess> nsaccess("NSAccess"); diff --git a/include/modules/nickserv/ajoin.h b/include/modules/nickserv/ajoin.h index 7b4cc20e5..342be9e4f 100644 --- a/include/modules/nickserv/ajoin.h +++ b/include/modules/nickserv/ajoin.h @@ -1,9 +1,10 @@ /* * - * (C) 2013-2014 Anope Team + * (C) 2013-2016 Anope Team * Contact us at team@anope.org * * Please read COPYING and README for further details. + * */ class AutoJoin : public Serialize::Object @@ -12,6 +13,8 @@ class AutoJoin : public Serialize::Object using Serialize::Object::Object; public: + static constexpr const char *const NAME = "autojoin"; + virtual NickServ::Account *GetOwner() anope_abstract; virtual void SetOwner(NickServ::Account *acc) anope_abstract; @@ -22,4 +25,3 @@ class AutoJoin : public Serialize::Object virtual void SetKey(const Anope::string &k) anope_abstract; }; -static Serialize::TypeReference<AutoJoin> autojoin("AutoJoin"); diff --git a/include/modules/nickserv/cert.h b/include/modules/nickserv/cert.h index be75fb9bf..9bb21a565 100644 --- a/include/modules/nickserv/cert.h +++ b/include/modules/nickserv/cert.h @@ -14,7 +14,9 @@ class NSCertEntry; class CertService : public Service { public: - CertService(Module *c) : Service(c, "CertService", "certs") { } + static constexpr const char *NAME = "certs"; + + CertService(Module *c) : Service(c, NAME) { } virtual NickServ::Account* FindAccountFromCert(const Anope::string &cert) anope_abstract; @@ -23,11 +25,11 @@ class CertService : public Service virtual NSCertEntry *FindCert(const std::vector<NSCertEntry *> &cl, const Anope::string &certfp) anope_abstract; }; -static ServiceReference<CertService> certservice("CertService", "certs"); - class NSCertEntry : public Serialize::Object { public: + static constexpr const char *NAME = "nscert"; + using Serialize::Object::Object; virtual NickServ::Account *GetAccount() anope_abstract; @@ -37,12 +39,14 @@ class NSCertEntry : public Serialize::Object virtual void SetCert(const Anope::string &) anope_abstract; }; -static Serialize::TypeReference<NSCertEntry> certentry("NSCertEntry"); - namespace Event { struct CoreExport NickCertEvents : Events { + static constexpr const char *NAME = "nickcertevents"; + + using Events::Events; + /** Called when a user adds an entry to their cert list * @param nc The nick * @param entry The entry @@ -62,5 +66,3 @@ namespace Event }; } - -template<> struct EventName<Event::NickCertEvents> { static constexpr const char *const name = "OnNickCert"; }; diff --git a/include/modules/nickserv/drop.h b/include/modules/nickserv/drop.h index bae9d77b6..096458510 100644 --- a/include/modules/nickserv/drop.h +++ b/include/modules/nickserv/drop.h @@ -10,13 +10,15 @@ namespace Event { struct CoreExport NickDrop : Events { + static constexpr const char *NAME = "nickdrop"; + + using Events::Events; + /** Called when a nick is dropped * @param source The source of the command * @param na The nick */ virtual void OnNickDrop(CommandSource &source, NickServ::Nick *na) anope_abstract; }; - extern CoreExport EventHandlers<NickDrop> OnNickDrop; } -template<> struct EventName<Event::NickDrop> { static constexpr const char *const name = "OnNickDrop"; }; diff --git a/include/modules/nickserv/group.h b/include/modules/nickserv/group.h index caa568a9e..b4648498f 100644 --- a/include/modules/nickserv/group.h +++ b/include/modules/nickserv/group.h @@ -11,6 +11,10 @@ namespace Event { struct CoreExport NickGroup : Events { + static constexpr const char *NAME = "nickgroup"; + + using Events::Events; + /** Called when a user groups their nick * @param u The user grouping * @param target The target they're grouping to @@ -19,4 +23,3 @@ namespace Event }; } -template<> struct EventName<Event::NickGroup> { static constexpr const char *const name = "OnNickGroup"; }; diff --git a/include/modules/nickserv/info.h b/include/modules/nickserv/info.h index e816cc356..c9177c1c7 100644 --- a/include/modules/nickserv/info.h +++ b/include/modules/nickserv/info.h @@ -11,6 +11,10 @@ namespace Event { struct CoreExport NickInfo : Events { + static constexpr const char *NAME = "nickinfo"; + + using Events::Events; + /** Called when a user requests info for a nick * @param source The user requesting info * @param na The nick the user is requesting info from @@ -21,4 +25,3 @@ namespace Event }; } -template<> struct EventName<Event::NickInfo> { static constexpr const char *const name = "OnNickInfo"; }; diff --git a/include/modules/nickserv/set.h b/include/modules/nickserv/set.h index c6b86032b..c8438be3a 100644 --- a/include/modules/nickserv/set.h +++ b/include/modules/nickserv/set.h @@ -11,6 +11,10 @@ namespace Event { struct CoreExport SetNickOption : Events { + static constexpr const char *NAME = "setnickoption"; + + using Events::Events; + /** Called when a nickserv/set command is used. * @param source The source of the command * @param cmd The command @@ -20,7 +24,5 @@ namespace Event */ virtual EventReturn OnSetNickOption(CommandSource &source, Command *cmd, NickServ::Account *nc, const Anope::string &setting) anope_abstract; }; - static EventHandlersReference<SetNickOption> OnSetNickOption; } -template<> struct EventName<Event::SetNickOption> { static constexpr const char *const name = "OnSetNickOption"; }; diff --git a/include/modules/nickserv/set_misc.h b/include/modules/nickserv/set_misc.h index 18d49dd0f..9bf593c7f 100644 --- a/include/modules/nickserv/set_misc.h +++ b/include/modules/nickserv/set_misc.h @@ -1,5 +1,5 @@ /* - * (C) 2014 Anope Team + * (C) 2014-2016 Anope Team * Contact us at team@anope.org * * Please read COPYING and README for further details. @@ -11,6 +11,8 @@ class NSMiscData : public Serialize::Object using Serialize::Object::Object; public: + static constexpr const char *const NAME = "nsmiscdata"; + virtual NickServ::Account *GetAccount() anope_abstract; virtual void SetAccount(NickServ::Account *) anope_abstract; @@ -21,5 +23,3 @@ class NSMiscData : public Serialize::Object virtual void SetData(const Anope::string &) anope_abstract; }; -static Serialize::TypeReference<NSMiscData> nsmiscdata("NSMiscData"); - diff --git a/include/modules/nickserv/suspend.h b/include/modules/nickserv/suspend.h index fcfc0265d..2cd8faab6 100644 --- a/include/modules/nickserv/suspend.h +++ b/include/modules/nickserv/suspend.h @@ -12,6 +12,8 @@ class NSSuspendInfo : public Serialize::Object using Serialize::Object::Object; public: + static constexpr const char *const NAME = "nssuspendinfo"; + virtual NickServ::Account *GetAccount() anope_abstract; virtual void SetAccount(NickServ::Account *) anope_abstract; @@ -28,12 +30,14 @@ class NSSuspendInfo : public Serialize::Object virtual void SetExpires(const time_t &) anope_abstract; }; -static Serialize::TypeReference<NSSuspendInfo> nssuspendinfo("NSSuspendInfo"); - namespace Event { struct CoreExport NickSuspend : Events { + static constexpr const char *NAME = "nicksuspend"; + + using Events::Events; + /** Called when a nick is suspended * @param na The nick alias */ @@ -42,12 +46,13 @@ namespace Event struct CoreExport NickUnsuspend : Events { + static constexpr const char *NAME = "nickunsuspend"; + + using Events::Events; + /** Called when a nick is unsuspneded * @param na The nick alias */ virtual void OnNickUnsuspend(NickServ::Nick *na) anope_abstract; }; } - -template<> struct EventName<Event::NickSuspend> { static constexpr const char *const name = "OnNickSuspend"; }; -template<> struct EventName<Event::NickUnsuspend> { static constexpr const char *const name = "OnNickUnsuspend"; }; diff --git a/include/modules/nickserv/update.h b/include/modules/nickserv/update.h index ce75c33ac..531c1d237 100644 --- a/include/modules/nickserv/update.h +++ b/include/modules/nickserv/update.h @@ -11,6 +11,10 @@ namespace Event { struct CoreExport NickUpdate : Events { + static constexpr const char *NAME = "nickupdate"; + + using Events::Events; + /** Called when a user does /ns update * @param u The user */ @@ -18,4 +22,3 @@ namespace Event }; } -template<> struct EventName<Event::NickUpdate> { static constexpr const char *const name = "OnNickUpdate"; }; |
