summaryrefslogtreecommitdiff
path: root/include/modules
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2014-12-10 01:29:18 -0500
committerAdam <Adam@anope.org>2014-12-10 01:29:18 -0500
commit3e5a5e1c669f6027b897f7358d45f92e1552f746 (patch)
tree5be9d41890d79eb0472f374b3f2a0ab9b36b1941 /include/modules
parent42238034490fb5479d787bd1695750387d508200 (diff)
Use a triat class for event names instead of having to manually give them places, which is much less error prone
Diffstat (limited to 'include/modules')
-rw-r--r--include/modules/bs_badwords.h1
-rw-r--r--include/modules/bs_bot.h4
-rw-r--r--include/modules/bs_info.h1
-rw-r--r--include/modules/bs_kick.h2
-rw-r--r--include/modules/chanserv.h7
-rw-r--r--include/modules/cs_access.h2
-rw-r--r--include/modules/cs_akick.h2
-rw-r--r--include/modules/cs_drop.h2
-rw-r--r--include/modules/cs_info.h1
-rw-r--r--include/modules/cs_mode.h1
-rw-r--r--include/modules/cs_set.h3
-rw-r--r--include/modules/cs_suspend.h2
-rw-r--r--include/modules/dns.h3
-rw-r--r--include/modules/fantasy.h3
-rw-r--r--include/modules/help.h2
-rw-r--r--include/modules/hs_del.h2
-rw-r--r--include/modules/memoserv.h12
-rw-r--r--include/modules/nickserv.h13
-rw-r--r--include/modules/ns_cert.h2
-rw-r--r--include/modules/ns_drop.h1
-rw-r--r--include/modules/ns_group.h2
-rw-r--r--include/modules/ns_info.h2
-rw-r--r--include/modules/ns_set.h4
-rw-r--r--include/modules/ns_suspend.h6
-rw-r--r--include/modules/ns_update.h1
-rw-r--r--include/modules/os_defcon.h1
-rw-r--r--include/modules/os_session.h1
27 files changed, 67 insertions, 16 deletions
diff --git a/include/modules/bs_badwords.h b/include/modules/bs_badwords.h
index df42af6ec..87986ee62 100644
--- a/include/modules/bs_badwords.h
+++ b/include/modules/bs_badwords.h
@@ -99,3 +99,4 @@ namespace Event
};
}
+template<> struct EventName<Event::BadWordEvents> { static constexpr const char *const name = "Badwords"; };
diff --git a/include/modules/bs_bot.h b/include/modules/bs_bot.h
index f66d57031..fe6534309 100644
--- a/include/modules/bs_bot.h
+++ b/include/modules/bs_bot.h
@@ -32,3 +32,7 @@ namespace Event
virtual void OnBotDelete(ServiceBot *bi) anope_abstract;
};
}
+
+template<> struct EventName<Event::BotCreate> { static constexpr const char *const name = "OnBotCreate"; };
+template<> struct EventName<Event::BotChange> { static constexpr const char *const name = "OnBotChange"; };
+template<> struct EventName<Event::BotDelete> { static constexpr const char *const name = "OnBotDelete"; };
diff --git a/include/modules/bs_info.h b/include/modules/bs_info.h
index 606888f4c..1ebd58c89 100644
--- a/include/modules/bs_info.h
+++ b/include/modules/bs_info.h
@@ -18,3 +18,4 @@ namespace Event
extern CoreExport EventHandlers<ServiceBotEvent> OnServiceBot;
}
+template<> struct EventName<Event::ServiceBotEvent> { static constexpr const char *const name = "OnServiceBot"; };
diff --git a/include/modules/bs_kick.h b/include/modules/bs_kick.h
index 4fe234dd0..1346d7427 100644
--- a/include/modules/bs_kick.h
+++ b/include/modules/bs_kick.h
@@ -128,3 +128,5 @@ namespace Event
};
}
+template<> struct EventName<Event::BotBan> { static constexpr const char *const name = "OnBotBan"; };
+
diff --git a/include/modules/chanserv.h b/include/modules/chanserv.h
index 9985f25dc..a6f741c1b 100644
--- a/include/modules/chanserv.h
+++ b/include/modules/chanserv.h
@@ -164,7 +164,7 @@ namespace ChanServ
*/
virtual void OnPreChanExpire(Channel *ci, bool &expire) anope_abstract;
};
- static EventHandlersReference<PreChanExpire> OnPreChanExpire("OnPreChanExpire");
+ static EventHandlersReference<PreChanExpire> OnPreChanExpire;
struct CoreExport ChanExpire : Events
{
@@ -173,7 +173,7 @@ namespace ChanServ
*/
virtual void OnChanExpire(Channel *ci) anope_abstract;
};
- static EventHandlersReference<ChanExpire> OnChanExpire("OnChanExpire");
+ static EventHandlersReference<ChanExpire> OnChanExpire;
}
/* It matters that Base is here before Extensible (it is inherited by Serializable)
@@ -734,3 +734,6 @@ namespace ChanServ
}
};
}
+
+template<> struct EventName<ChanServ::Event::PreChanExpire> { static constexpr const char *const name = "OnPreChanExpire"; };
+template<> struct EventName<ChanServ::Event::ChanExpire> { static constexpr const char *const name = "OnChanExpire"; };
diff --git a/include/modules/cs_access.h b/include/modules/cs_access.h
index b56996ede..54eb3f353 100644
--- a/include/modules/cs_access.h
+++ b/include/modules/cs_access.h
@@ -24,3 +24,5 @@ namespace Event
virtual void OnLevelChange(CommandSource &source, ChanServ::Channel *ci, const Anope::string &priv, int16_t what) anope_abstract;
};
}
+
+template<> struct EventName<Event::LevelChange> { static constexpr const char *const name = "OnLevelChange"; };
diff --git a/include/modules/cs_akick.h b/include/modules/cs_akick.h
index a5c050e51..966dac15b 100644
--- a/include/modules/cs_akick.h
+++ b/include/modules/cs_akick.h
@@ -60,3 +60,5 @@ namespace Event
virtual void OnAkickDel(CommandSource &source, ChanServ::Channel *ci, const AutoKick *ak) anope_abstract;
};
}
+
+template<> struct EventName<Event::Akick> { static constexpr const char *const name = "Akick"; };
diff --git a/include/modules/cs_drop.h b/include/modules/cs_drop.h
index 49247b3cb..db231059b 100644
--- a/include/modules/cs_drop.h
+++ b/include/modules/cs_drop.h
@@ -18,3 +18,5 @@ namespace Event
virtual EventReturn OnChanDrop(CommandSource &source, ChanServ::Channel *ci) anope_abstract;
};
}
+
+template<> struct EventName<Event::ChanDrop> { static constexpr const char *const name = "OnChanDrop"; };
diff --git a/include/modules/cs_info.h b/include/modules/cs_info.h
index 7b19abd19..f80e3daf2 100644
--- a/include/modules/cs_info.h
+++ b/include/modules/cs_info.h
@@ -21,3 +21,4 @@ namespace Event
};
}
+template<> struct EventName<Event::ChanInfo> { static constexpr const char *const name = "OnChanInfo"; };
diff --git a/include/modules/cs_mode.h b/include/modules/cs_mode.h
index a27197533..4d5f9dd2f 100644
--- a/include/modules/cs_mode.h
+++ b/include/modules/cs_mode.h
@@ -120,3 +120,4 @@ namespace Event
};
}
+template<> struct EventName<Event::MLockEvents> { static constexpr const char *const name = "MLock"; };
diff --git a/include/modules/cs_set.h b/include/modules/cs_set.h
index 355459f7c..a0e81c888 100644
--- a/include/modules/cs_set.h
+++ b/include/modules/cs_set.h
@@ -20,6 +20,7 @@ namespace Event
*/
virtual EventReturn OnSetChannelOption(CommandSource &source, Command *cmd, ChanServ::Channel *ci, const Anope::string &setting) anope_abstract;
};
- static EventHandlersReference<SetChannelOption> OnSetChannelOption("OnSetChannelOption");
+ static EventHandlersReference<SetChannelOption> OnSetChannelOption;
}
+template<> struct EventName<Event::SetChannelOption> { static constexpr const char *const name = "OnSetChannelOption"; };
diff --git a/include/modules/cs_suspend.h b/include/modules/cs_suspend.h
index 6c561b637..27187ea09 100644
--- a/include/modules/cs_suspend.h
+++ b/include/modules/cs_suspend.h
@@ -49,3 +49,5 @@ namespace Event
extern CoreExport EventHandlers<ChanUnsuspend> OnChanUnsuspend;
}
+template<> struct EventName<Event::ChanSuspend> { static constexpr const char *const name = "OnChanSuspend"; };
+template<> struct EventName<Event::ChanUnsuspend> { static constexpr const char *const name = "OnChanUnsuspend"; };
diff --git a/include/modules/dns.h b/include/modules/dns.h
index 7a0a587fa..f1ee94f87 100644
--- a/include/modules/dns.h
+++ b/include/modules/dns.h
@@ -188,9 +188,10 @@ namespace Event
*/
virtual void OnDnsRequest(DNS::Query &req, DNS::Query *reply) anope_abstract;
};
- static EventHandlersReference<DnsRequest> OnDnsRequest("OnDnsRequest");
+ static EventHandlersReference<DnsRequest> OnDnsRequest;
}
+template<> struct EventName<Event::DnsRequest> { static constexpr const char *const name = "OnDnsRequest"; };
#endif // DNS_H
diff --git a/include/modules/fantasy.h b/include/modules/fantasy.h
index bb13b959d..1bdd8afdc 100644
--- a/include/modules/fantasy.h
+++ b/include/modules/fantasy.h
@@ -33,3 +33,6 @@ namespace Event
virtual EventReturn OnBotNoFantasyAccess(CommandSource &source, Command *c, ChanServ::Channel *ci, const std::vector<Anope::string> &params) anope_abstract;
};
}
+
+template<> struct EventName<Event::BotFantasy> { static constexpr const char *const name = "OnBotFantasy"; };
+template<> struct EventName<Event::BotNoFantasyAccess> { static constexpr const char *const name = "OnBotNoFantasyAccess"; };
diff --git a/include/modules/help.h b/include/modules/help.h
index 333e5f9c8..df81aecbf 100644
--- a/include/modules/help.h
+++ b/include/modules/help.h
@@ -25,3 +25,5 @@ namespace Event
virtual void OnPostHelp(CommandSource &source, const std::vector<Anope::string> &params) anope_abstract;
};
}
+
+template<> struct EventName<Event::Help> { static constexpr const char *const name = "Help"; };
diff --git a/include/modules/hs_del.h b/include/modules/hs_del.h
index fdec23b21..9b2ea39ef 100644
--- a/include/modules/hs_del.h
+++ b/include/modules/hs_del.h
@@ -16,3 +16,5 @@ namespace Event
virtual void OnDeleteVhost(NickServ::Nick *na) anope_abstract;
};
}
+
+template<> struct EventName<Event::DeleteVhost> { static constexpr const char *const name = "OnDeleteVhost"; };
diff --git a/include/modules/memoserv.h b/include/modules/memoserv.h
index 9a209e27f..b7d49ad3a 100644
--- a/include/modules/memoserv.h
+++ b/include/modules/memoserv.h
@@ -61,7 +61,7 @@ namespace MemoServ
*/
virtual void OnMemoSend(const Anope::string &source, const Anope::string &target, MemoInfo *mi, Memo *m) anope_abstract;
};
- static EventHandlersReference<MemoSend> OnMemoSend("OnMemoSend");
+ static EventHandlersReference<MemoSend> OnMemoSend;
struct CoreExport MemoDel : Events
{
@@ -72,14 +72,14 @@ namespace MemoServ
*/
virtual void OnMemoDel(const Anope::string &target, MemoInfo *mi, const Memo *m) anope_abstract;
};
- static EventHandlersReference<MemoDel> OnMemoDel("OnMemoDel");
+ static EventHandlersReference<MemoDel> OnMemoDel;
}
class Memo : public Serialize::Object
{
protected:
using Serialize::Object::Object;
-// Memo() : Serialize::Object("Memo") { }
+
public:
virtual MemoInfo *GetMemoInfo() anope_abstract;
virtual void SetMemoInfo(MemoInfo *) anope_abstract;
@@ -109,8 +109,7 @@ namespace MemoServ
{
protected:
using Serialize::Object::Object;
- //using MemoInfo::MemoInfo;
- //MemoInfo() : Serialize::Object("MemoInfo") { }
+
public:
virtual Memo *GetMemo(unsigned index) anope_abstract;
@@ -148,3 +147,6 @@ namespace MemoServ
static Serialize::TypeReference<Ignore> ignore("MemoIgnore");
}
+
+template<> struct EventName<MemoServ::Event::MemoSend> { static constexpr const char *const name = "OnMemoSend"; };
+template<> struct EventName<MemoServ::Event::MemoDel> { static constexpr const char *const name = "OnMemoDel"; };
diff --git a/include/modules/nickserv.h b/include/modules/nickserv.h
index 84ff39520..a6921cf2e 100644
--- a/include/modules/nickserv.h
+++ b/include/modules/nickserv.h
@@ -67,7 +67,7 @@ namespace NickServ
*/
virtual void OnPreNickExpire(Nick *na, bool &expire) anope_abstract;
};
- static EventHandlersReference<PreNickExpire> OnPreNickExpire("OnPreNickExpire");
+ static EventHandlersReference<PreNickExpire> OnPreNickExpire;
struct CoreExport NickExpire : Events
{
@@ -76,7 +76,7 @@ namespace NickServ
*/
virtual void OnNickExpire(Nick *na) anope_abstract;
};
- static EventHandlersReference<NickExpire> OnNickExpire("OnNickExpire");
+ static EventHandlersReference<NickExpire> OnNickExpire;
struct CoreExport NickRegister : Events
{
@@ -87,7 +87,7 @@ namespace NickServ
*/
virtual void OnNickRegister(User *user, Nick *na, const Anope::string &password) anope_abstract;
};
- static EventHandlersReference<NickRegister> OnNickRegister("OnNickRegister");
+ static EventHandlersReference<NickRegister> OnNickRegister;
struct CoreExport NickValidate : Events
{
@@ -99,7 +99,7 @@ namespace NickServ
*/
virtual EventReturn OnNickValidate(User *u, Nick *na) anope_abstract;
};
- static EventHandlersReference<NickValidate> OnNickValidate("OnNickValidate");
+ static EventHandlersReference<NickValidate> OnNickValidate;
}
/* A registered nickname.
@@ -293,3 +293,8 @@ namespace NickServ
static Serialize::TypeReference<Mode> mode("NSKeepMode");
}
+
+template<> struct EventName<NickServ::Event::PreNickExpire> { static constexpr const char *const name = "OnPreNickExpire"; };
+template<> struct EventName<NickServ::Event::NickExpire> { static constexpr const char *const name = "OnNickExpire"; };
+template<> struct EventName<NickServ::Event::NickRegister> { static constexpr const char *const name = "OnNickRegister"; };
+template<> struct EventName<NickServ::Event::NickValidate> { static constexpr const char *const name = "OnNickValidate"; };
diff --git a/include/modules/ns_cert.h b/include/modules/ns_cert.h
index 994f0378e..be75fb9bf 100644
--- a/include/modules/ns_cert.h
+++ b/include/modules/ns_cert.h
@@ -62,3 +62,5 @@ namespace Event
};
}
+
+template<> struct EventName<Event::NickCertEvents> { static constexpr const char *const name = "OnNickCert"; };
diff --git a/include/modules/ns_drop.h b/include/modules/ns_drop.h
index 9217a924c..bae9d77b6 100644
--- a/include/modules/ns_drop.h
+++ b/include/modules/ns_drop.h
@@ -19,3 +19,4 @@ namespace Event
extern CoreExport EventHandlers<NickDrop> OnNickDrop;
}
+template<> struct EventName<Event::NickDrop> { static constexpr const char *const name = "OnNickDrop"; };
diff --git a/include/modules/ns_group.h b/include/modules/ns_group.h
index a254c4412..caa568a9e 100644
--- a/include/modules/ns_group.h
+++ b/include/modules/ns_group.h
@@ -18,3 +18,5 @@ namespace Event
virtual void OnNickGroup(User *u, NickServ::Nick *target) anope_abstract;
};
}
+
+template<> struct EventName<Event::NickGroup> { static constexpr const char *const name = "OnNickGroup"; };
diff --git a/include/modules/ns_info.h b/include/modules/ns_info.h
index dd593ce59..e816cc356 100644
--- a/include/modules/ns_info.h
+++ b/include/modules/ns_info.h
@@ -20,3 +20,5 @@ namespace Event
virtual void OnNickInfo(CommandSource &source, NickServ::Nick *na, InfoFormatter &info, bool show_hidden) anope_abstract;
};
}
+
+template<> struct EventName<Event::NickInfo> { static constexpr const char *const name = "OnNickInfo"; };
diff --git a/include/modules/ns_set.h b/include/modules/ns_set.h
index b958b4cf5..c6b86032b 100644
--- a/include/modules/ns_set.h
+++ b/include/modules/ns_set.h
@@ -20,5 +20,7 @@ namespace Event
*/
virtual EventReturn OnSetNickOption(CommandSource &source, Command *cmd, NickServ::Account *nc, const Anope::string &setting) anope_abstract;
};
- static EventHandlersReference<SetNickOption> OnSetNickOption("OnSetNickOption");
+ static EventHandlersReference<SetNickOption> OnSetNickOption;
}
+
+template<> struct EventName<Event::SetNickOption> { static constexpr const char *const name = "OnSetNickOption"; };
diff --git a/include/modules/ns_suspend.h b/include/modules/ns_suspend.h
index b985cb218..fcfc0265d 100644
--- a/include/modules/ns_suspend.h
+++ b/include/modules/ns_suspend.h
@@ -40,12 +40,14 @@ namespace Event
virtual void OnNickSuspend(NickServ::Nick *na) anope_abstract;
};
- struct CoreExport NickUnsuspended : Events
+ struct CoreExport NickUnsuspend : Events
{
/** Called when a nick is unsuspneded
* @param na The nick alias
*/
- virtual void OnNickUnsuspended(NickServ::Nick *na) anope_abstract;
+ 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/ns_update.h b/include/modules/ns_update.h
index d5d01320a..ce75c33ac 100644
--- a/include/modules/ns_update.h
+++ b/include/modules/ns_update.h
@@ -18,3 +18,4 @@ namespace Event
};
}
+template<> struct EventName<Event::NickUpdate> { static constexpr const char *const name = "OnNickUpdate"; };
diff --git a/include/modules/os_defcon.h b/include/modules/os_defcon.h
index 81b220eb3..f980d5008 100644
--- a/include/modules/os_defcon.h
+++ b/include/modules/os_defcon.h
@@ -18,3 +18,4 @@ namespace Event
};
}
+template<> struct EventName<Event::DefconLevel> { static constexpr const char *const name = "OnDefconLevel"; };
diff --git a/include/modules/os_session.h b/include/modules/os_session.h
index c6af4fb03..b9afd196e 100644
--- a/include/modules/os_session.h
+++ b/include/modules/os_session.h
@@ -74,3 +74,4 @@ namespace Event
};
}
+template<> struct EventName<Event::Exception> { static constexpr const char *const name = "Exception"; };