diff options
34 files changed, 98 insertions, 47 deletions
diff --git a/include/extensible.h b/include/extensible.h index 86e0d6b07..a2c104377 100644 --- a/include/extensible.h +++ b/include/extensible.h @@ -38,7 +38,20 @@ enum SerializeFormat class CoreExport ExtensionItem : public ServiceProvider, public usecountbase { public: - ExtensionItem(const std::string& key, Module* owner); + /** Extensible subclasses + */ + enum ExtensibleType + { + EXT_USER, + EXT_CHANNEL, + EXT_MEMBERSHIP + }; + + /** Type (subclass) of Extensible that this ExtensionItem is valid for + */ + const ExtensibleType type; + + ExtensionItem(const std::string& key, ExtensibleType exttype, Module* owner); virtual ~ExtensionItem(); /** Serialize this item into a string * @@ -119,7 +132,7 @@ class CoreExport ExtensionManager class CoreExport LocalExtItem : public ExtensionItem { public: - LocalExtItem(const std::string& key, Module* owner); + LocalExtItem(const std::string& key, ExtensibleType exttype, Module* owner); virtual ~LocalExtItem(); virtual std::string serialize(SerializeFormat format, const Extensible* container, void* item) const; virtual void unserialize(SerializeFormat format, Extensible* container, const std::string& value); @@ -130,7 +143,8 @@ template <typename T, typename Del = stdalgo::defaultdeleter<T> > class SimpleExtItem : public LocalExtItem { public: - SimpleExtItem(const std::string& Key, Module* parent) : LocalExtItem(Key, parent) + SimpleExtItem(const std::string& Key, ExtensibleType exttype, Module* parent) + : LocalExtItem(Key, exttype, parent) { } @@ -175,7 +189,7 @@ class SimpleExtItem : public LocalExtItem class CoreExport LocalStringExt : public SimpleExtItem<std::string> { public: - LocalStringExt(const std::string& key, Module* owner); + LocalStringExt(const std::string& key, ExtensibleType exttype, Module* owner); virtual ~LocalStringExt(); std::string serialize(SerializeFormat format, const Extensible* container, void* item) const; }; @@ -183,7 +197,7 @@ class CoreExport LocalStringExt : public SimpleExtItem<std::string> class CoreExport LocalIntExt : public LocalExtItem { public: - LocalIntExt(const std::string& key, Module* owner); + LocalIntExt(const std::string& key, ExtensibleType exttype, Module* owner); virtual ~LocalIntExt(); std::string serialize(SerializeFormat format, const Extensible* container, void* item) const; intptr_t get(const Extensible* container) const; @@ -195,7 +209,7 @@ class CoreExport LocalIntExt : public LocalExtItem class CoreExport StringExtItem : public ExtensionItem { public: - StringExtItem(const std::string& key, Module* owner); + StringExtItem(const std::string& key, ExtensibleType exttype, Module* owner); virtual ~StringExtItem(); std::string* get(const Extensible* container) const; std::string serialize(SerializeFormat format, const Extensible* container, void* item) const; diff --git a/include/modules/cap.h b/include/modules/cap.h index 1b33e05bb..cc1cb8d8c 100644 --- a/include/modules/cap.h +++ b/include/modules/cap.h @@ -43,7 +43,9 @@ class GenericCap public: LocalIntExt ext; const std::string cap; - GenericCap(Module* parent, const std::string &Cap) : ext("cap_" + Cap, parent), cap(Cap) + GenericCap(Module* parent, const std::string& Cap) + : ext("cap_" + Cap, ExtensionItem::EXT_USER, parent) + , cap(Cap) { } diff --git a/include/parammode.h b/include/parammode.h index b0005262e..b00082bd6 100644 --- a/include/parammode.h +++ b/include/parammode.h @@ -56,7 +56,7 @@ class ParamMode : public ParamModeBase */ ParamMode(Module* Creator, const std::string& Name, char modeletter, ParamSpec ps = PARAM_SETONLY) : ParamModeBase(Creator, Name, modeletter, ps) - , ext("parammode_" + Name, Creator) + , ext("parammode_" + Name, ExtensionItem::EXT_CHANNEL, Creator) { } diff --git a/src/base.cpp b/src/base.cpp index c131f4dae..0441217d1 100644 --- a/src/base.cpp +++ b/src/base.cpp @@ -89,7 +89,9 @@ ServiceProvider::~ServiceProvider() { } -ExtensionItem::ExtensionItem(const std::string& Key, Module* mod) : ServiceProvider(mod, Key, SERVICE_METADATA) +ExtensionItem::ExtensionItem(const std::string& Key, ExtensibleType exttype, Module* mod) + : ServiceProvider(mod, Key, SERVICE_METADATA) + , type(exttype) { } @@ -201,7 +203,8 @@ Extensible::~Extensible() ServerInstance->Logs->Log("CULLLIST", LOG_DEBUG, "Extensible destructor called without cull @%p", (void*)this); } -LocalExtItem::LocalExtItem(const std::string& Key, Module* mod) : ExtensionItem(Key, mod) +LocalExtItem::LocalExtItem(const std::string& Key, ExtensibleType exttype, Module* mod) + : ExtensionItem(Key, exttype, mod) { } @@ -218,8 +221,10 @@ void LocalExtItem::unserialize(SerializeFormat format, Extensible* container, co { } -LocalStringExt::LocalStringExt(const std::string& Key, Module* Owner) - : SimpleExtItem<std::string>(Key, Owner) { } +LocalStringExt::LocalStringExt(const std::string& Key, ExtensibleType exttype, Module* Owner) + : SimpleExtItem<std::string>(Key, exttype, Owner) +{ +} LocalStringExt::~LocalStringExt() { @@ -232,7 +237,8 @@ std::string LocalStringExt::serialize(SerializeFormat format, const Extensible* return ""; } -LocalIntExt::LocalIntExt(const std::string& Key, Module* mod) : LocalExtItem(Key, mod) +LocalIntExt::LocalIntExt(const std::string& Key, ExtensibleType exttype, Module* mod) + : LocalExtItem(Key, exttype, mod) { } @@ -264,7 +270,8 @@ void LocalIntExt::free(void*) { } -StringExtItem::StringExtItem(const std::string& Key, Module* mod) : ExtensionItem(Key, mod) +StringExtItem::StringExtItem(const std::string& Key, ExtensibleType exttype, Module* mod) + : ExtensionItem(Key, exttype, mod) { } diff --git a/src/coremods/core_hostname_lookup.cpp b/src/coremods/core_hostname_lookup.cpp index 2c9de3c86..11cc5bbba 100644 --- a/src/coremods/core_hostname_lookup.cpp +++ b/src/coremods/core_hostname_lookup.cpp @@ -183,8 +183,8 @@ class ModuleHostnameLookup : public Module public: ModuleHostnameLookup() - : dnsLookup("dnsLookup", this) - , ptrHosts("ptrHosts", this) + : dnsLookup("dnsLookup", ExtensionItem::EXT_USER, this) + , ptrHosts("ptrHosts", ExtensionItem::EXT_USER, this) , DNS(this, "DNS") { dl = &dnsLookup; diff --git a/src/inspircd.cpp b/src/inspircd.cpp index 403ba5355..469539c5b 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -229,7 +229,7 @@ InspIRCd::InspIRCd(int argc, char** argv) : * THIS MUST MATCH THE ORDER OF DECLARATION OF THE FUNCTORS, e.g. the methods * themselves within the class. */ - OperQuit("operquit", NULL), + OperQuit("operquit", ExtensionItem::EXT_USER, NULL), GenRandom(&HandleGenRandom), IsChannel(&HandleIsChannel), IsNick(&HandleIsNick), diff --git a/src/listmode.cpp b/src/listmode.cpp index 1147a4ef2..35964dfb3 100644 --- a/src/listmode.cpp +++ b/src/listmode.cpp @@ -22,7 +22,8 @@ ListModeBase::ListModeBase(Module* Creator, const std::string& Name, char modechar, const std::string &eolstr, unsigned int lnum, unsigned int eolnum, bool autotidy, const std::string &ctag) : ModeHandler(Creator, Name, modechar, PARAM_ALWAYS, MODETYPE_CHANNEL, MC_LIST), listnumeric(lnum), endoflistnumeric(eolnum), endofliststring(eolstr), tidy(autotidy), - configtag(ctag), extItem("listbase_mode_" + name + "_list", Creator) + configtag(ctag) + , extItem("listbase_mode_" + name + "_list", ExtensionItem::EXT_CHANNEL, Creator) { list = true; } diff --git a/src/modules/extra/m_geoip.cpp b/src/modules/extra/m_geoip.cpp index 3561d1a5d..d21a82149 100644 --- a/src/modules/extra/m_geoip.cpp +++ b/src/modules/extra/m_geoip.cpp @@ -46,7 +46,9 @@ class ModuleGeoIP : public Module } public: - ModuleGeoIP() : ext("geoip_cc", this), gi(NULL) + ModuleGeoIP() + : ext("geoip_cc", ExtensionItem::EXT_USER, this) + , gi(NULL) { } diff --git a/src/modules/m_banredirect.cpp b/src/modules/m_banredirect.cpp index 9833c720d..d3490acc0 100644 --- a/src/modules/m_banredirect.cpp +++ b/src/modules/m_banredirect.cpp @@ -50,7 +50,7 @@ class BanRedirect : public ModeWatcher BanRedirect(Module* parent) : ModeWatcher(parent, "ban", MODETYPE_CHANNEL) , ban(parent, "ban") - , extItem("banredirect", parent) + , extItem("banredirect", ExtensionItem::EXT_CHANNEL, parent) { } diff --git a/src/modules/m_blockamsg.cpp b/src/modules/m_blockamsg.cpp index b456606a8..9614203c3 100644 --- a/src/modules/m_blockamsg.cpp +++ b/src/modules/m_blockamsg.cpp @@ -53,7 +53,8 @@ class ModuleBlockAmsg : public Module SimpleExtItem<BlockedMessage> blockamsg; public: - ModuleBlockAmsg() : blockamsg("blockamsg", this) + ModuleBlockAmsg() + : blockamsg("blockamsg", ExtensionItem::EXT_USER, this) { } diff --git a/src/modules/m_callerid.cpp b/src/modules/m_callerid.cpp index efbf1a81b..5c6d14a90 100644 --- a/src/modules/m_callerid.cpp +++ b/src/modules/m_callerid.cpp @@ -69,7 +69,7 @@ class callerid_data struct CallerIDExtInfo : public ExtensionItem { CallerIDExtInfo(Module* parent) - : ExtensionItem("callerid_data", parent) + : ExtensionItem("callerid_data", ExtensionItem::EXT_USER, parent) { } diff --git a/src/modules/m_cap.cpp b/src/modules/m_cap.cpp index bc79e59ec..db5d85f0f 100644 --- a/src/modules/m_cap.cpp +++ b/src/modules/m_cap.cpp @@ -42,7 +42,7 @@ class CommandCAP : public Command public: LocalIntExt reghold; CommandCAP (Module* mod) : Command(mod, "CAP", 1), - reghold("CAP_REGHOLD", mod) + reghold("CAP_REGHOLD", ExtensionItem::EXT_USER, mod) { works_before_reg = true; } diff --git a/src/modules/m_cgiirc.cpp b/src/modules/m_cgiirc.cpp index 791045780..721d6ba08 100644 --- a/src/modules/m_cgiirc.cpp +++ b/src/modules/m_cgiirc.cpp @@ -74,7 +74,8 @@ class CommandWebirc : public Command CGIHostlist Hosts; CommandWebirc(Module* Creator) : Command(Creator, "WEBIRC", 4), - realhost("cgiirc_realhost", Creator), realip("cgiirc_realip", Creator) + realhost("cgiirc_realhost", ExtensionItem::EXT_USER, Creator) + , realip("cgiirc_realip", ExtensionItem::EXT_USER, Creator) { works_before_reg = true; this->syntax = "password client hostname ip"; @@ -225,7 +226,7 @@ class ModuleCgiIRC : public Module public: ModuleCgiIRC() : cmd(this) - , waiting("cgiirc-delay", this) + , waiting("cgiirc-delay", ExtensionItem::EXT_USER, this) , DNS(this, "DNS") { } diff --git a/src/modules/m_cloaking.cpp b/src/modules/m_cloaking.cpp index d0e7313b7..1534043ce 100644 --- a/src/modules/m_cloaking.cpp +++ b/src/modules/m_cloaking.cpp @@ -49,7 +49,7 @@ class CloakUser : public ModeHandler CloakUser(Module* source) : ModeHandler(source, "cloak", 'x', PARAM_NONE, MODETYPE_USER), - ext("cloaked_host", source), debounce_ts(0), debounce_count(0) + ext("cloaked_host", ExtensionItem::EXT_USER, source), debounce_ts(0), debounce_count(0) { } diff --git a/src/modules/m_conn_join.cpp b/src/modules/m_conn_join.cpp index d5a095e7f..b22dbdf4d 100644 --- a/src/modules/m_conn_join.cpp +++ b/src/modules/m_conn_join.cpp @@ -66,7 +66,8 @@ class ModuleConnJoin : public Module unsigned int defdelay; public: - ModuleConnJoin() : ext("join_timer", this) + ModuleConnJoin() + : ext("join_timer", ExtensionItem::EXT_USER, this) { } diff --git a/src/modules/m_conn_waitpong.cpp b/src/modules/m_conn_waitpong.cpp index 496b04c2d..87b6b51f2 100644 --- a/src/modules/m_conn_waitpong.cpp +++ b/src/modules/m_conn_waitpong.cpp @@ -32,7 +32,7 @@ class ModuleWaitPong : public Module public: ModuleWaitPong() - : ext("waitpong_pingstr", this) + : ext("waitpong_pingstr", ExtensionItem::EXT_USER, this) { } diff --git a/src/modules/m_customtitle.cpp b/src/modules/m_customtitle.cpp index 3386e8cd7..67eca6dda 100644 --- a/src/modules/m_customtitle.cpp +++ b/src/modules/m_customtitle.cpp @@ -28,7 +28,7 @@ class CommandTitle : public Command public: StringExtItem ctitle; CommandTitle(Module* Creator) : Command(Creator,"TITLE", 2), - ctitle("ctitle", Creator) + ctitle("ctitle", ExtensionItem::EXT_USER, Creator) { syntax = "<user> <password>"; } diff --git a/src/modules/m_dccallow.cpp b/src/modules/m_dccallow.cpp index 7627ba8c7..2b8d1306c 100644 --- a/src/modules/m_dccallow.cpp +++ b/src/modules/m_dccallow.cpp @@ -257,7 +257,7 @@ class ModuleDCCAllow : public Module public: ModuleDCCAllow() - : ext("dccallow", this) + : ext("dccallow", ExtensionItem::EXT_USER, this) , cmd(this, ext) { } diff --git a/src/modules/m_delayjoin.cpp b/src/modules/m_delayjoin.cpp index 7e800572e..e864a8289 100644 --- a/src/modules/m_delayjoin.cpp +++ b/src/modules/m_delayjoin.cpp @@ -39,7 +39,9 @@ class ModuleDelayJoin : public Module DelayJoinMode djm; public: LocalIntExt unjoined; - ModuleDelayJoin() : djm(this), unjoined("delayjoin", this) + ModuleDelayJoin() + : djm(this) + , unjoined("delayjoin", ExtensionItem::EXT_MEMBERSHIP, this) { } diff --git a/src/modules/m_delaymsg.cpp b/src/modules/m_delaymsg.cpp index 32a0ba96e..f64297e15 100644 --- a/src/modules/m_delaymsg.cpp +++ b/src/modules/m_delaymsg.cpp @@ -25,7 +25,7 @@ class DelayMsgMode : public ParamMode<DelayMsgMode, LocalIntExt> LocalIntExt jointime; DelayMsgMode(Module* Parent) : ParamMode<DelayMsgMode, LocalIntExt>(Parent, "delaymsg", 'd') - , jointime("delaymsg", Parent) + , jointime("delaymsg", ExtensionItem::EXT_MEMBERSHIP, Parent) { levelrequired = OP_VALUE; } diff --git a/src/modules/m_dnsbl.cpp b/src/modules/m_dnsbl.cpp index 63dda547f..7b38da4bf 100644 --- a/src/modules/m_dnsbl.cpp +++ b/src/modules/m_dnsbl.cpp @@ -236,7 +236,12 @@ class ModuleDNSBL : public Module return DNSBLConfEntry::I_UNKNOWN; } public: - ModuleDNSBL() : DNS(this, "DNS"), nameExt("dnsbl_match", this), countExt("dnsbl_pending", this) { } + ModuleDNSBL() + : DNS(this, "DNS") + , nameExt("dnsbl_match", ExtensionItem::EXT_USER, this) + , countExt("dnsbl_pending", ExtensionItem::EXT_USER, this) + { + } Version GetVersion() CXX11_OVERRIDE { diff --git a/src/modules/m_ident.cpp b/src/modules/m_ident.cpp index 3e87b8c5a..959e58a47 100644 --- a/src/modules/m_ident.cpp +++ b/src/modules/m_ident.cpp @@ -277,7 +277,8 @@ class ModuleIdent : public Module bool NoLookupPrefix; SimpleExtItem<IdentRequestSocket, stdalgo::culldeleter> ext; public: - ModuleIdent() : ext("ident_socket", this) + ModuleIdent() + : ext("ident_socket", ExtensionItem::EXT_USER, this) { } diff --git a/src/modules/m_ldapauth.cpp b/src/modules/m_ldapauth.cpp index eee357ec0..804f6b821 100644 --- a/src/modules/m_ldapauth.cpp +++ b/src/modules/m_ldapauth.cpp @@ -307,8 +307,8 @@ class ModuleLDAPAuth : public Module public: ModuleLDAPAuth() : LDAP(this, "LDAP") - , ldapAuthed("ldapauth", this) - , ldapVhost("ldapauth_vhost", this) + , ldapAuthed("ldapauth", ExtensionItem::EXT_USER, this) + , ldapVhost("ldapauth_vhost", ExtensionItem::EXT_USER, this) { me = this; authed = &ldapAuthed; diff --git a/src/modules/m_mlock.cpp b/src/modules/m_mlock.cpp index d9c43ec10..9b0fa8dab 100644 --- a/src/modules/m_mlock.cpp +++ b/src/modules/m_mlock.cpp @@ -25,7 +25,7 @@ class ModuleMLock : public Module public: ModuleMLock() - : mlock("mlock", this) + : mlock("mlock", ExtensionItem::EXT_CHANNEL, this) { } diff --git a/src/modules/m_nicklock.cpp b/src/modules/m_nicklock.cpp index 9bf16498a..8ac2e8b47 100644 --- a/src/modules/m_nicklock.cpp +++ b/src/modules/m_nicklock.cpp @@ -144,7 +144,9 @@ class ModuleNickLock : public Module CommandNickunlock cmd2; public: ModuleNickLock() - : locked("nick_locked", this), cmd1(this, locked), cmd2(this, locked) + : locked("nick_locked", ExtensionItem::EXT_USER, this) + , cmd1(this, locked) + , cmd2(this, locked) { } diff --git a/src/modules/m_repeat.cpp b/src/modules/m_repeat.cpp index ca6955040..820ef702f 100644 --- a/src/modules/m_repeat.cpp +++ b/src/modules/m_repeat.cpp @@ -122,7 +122,7 @@ class RepeatMode : public ParamMode<RepeatMode, SimpleExtItem<ChannelSettings> > RepeatMode(Module* Creator) : ParamMode<RepeatMode, SimpleExtItem<ChannelSettings> >(Creator, "repeat", 'E') - , MemberInfoExt("repeat_memb", Creator) + , MemberInfoExt("repeat_memb", ExtensionItem::EXT_MEMBERSHIP, Creator) { } diff --git a/src/modules/m_sasl.cpp b/src/modules/m_sasl.cpp index 074362651..0a2c840bd 100644 --- a/src/modules/m_sasl.cpp +++ b/src/modules/m_sasl.cpp @@ -249,7 +249,10 @@ class ModuleSASL : public Module public: ModuleSASL() - : authExt("sasl_auth", this), cap(this, "sasl"), auth(this, authExt, cap), sasl(this, authExt) + : authExt("sasl_auth", ExtensionItem::EXT_USER, this) + , cap(this, "sasl") + , auth(this, authExt, cap) + , sasl(this, authExt) { } diff --git a/src/modules/m_services_account.cpp b/src/modules/m_services_account.cpp index 9630128e0..b778c16ed 100644 --- a/src/modules/m_services_account.cpp +++ b/src/modules/m_services_account.cpp @@ -106,7 +106,7 @@ class AccountExtItemImpl : public AccountExtItem { public: AccountExtItemImpl(Module* mod) - : AccountExtItem("accountname", mod) + : AccountExtItem("accountname", ExtensionItem::EXT_USER, mod) { } diff --git a/src/modules/m_silence.cpp b/src/modules/m_silence.cpp index 22de0ac8b..91822b4e4 100644 --- a/src/modules/m_silence.cpp +++ b/src/modules/m_silence.cpp @@ -106,7 +106,8 @@ class CommandSilence : public Command public: SimpleExtItem<silencelist> ext; CommandSilence(Module* Creator, unsigned int &max) : Command(Creator, "SILENCE", 0), - maxsilence(max), ext("silence_list", Creator) + maxsilence(max) + , ext("silence_list", ExtensionItem::EXT_USER, Creator) { allow_empty_last_param = false; syntax = "{[+|-]<mask> <p|c|i|n|t|a|x>}"; diff --git a/src/modules/m_sqlauth.cpp b/src/modules/m_sqlauth.cpp index 8a0b80ce1..1a5b68dd9 100644 --- a/src/modules/m_sqlauth.cpp +++ b/src/modules/m_sqlauth.cpp @@ -78,7 +78,9 @@ class ModuleSQLAuth : public Module bool verbose; public: - ModuleSQLAuth() : pendingExt("sqlauth-wait", this), SQL(this, "SQL") + ModuleSQLAuth() + : pendingExt("sqlauth-wait", ExtensionItem::EXT_USER, this) + , SQL(this, "SQL") { } diff --git a/src/modules/m_sslinfo.cpp b/src/modules/m_sslinfo.cpp index c354e4e0e..f861f1236 100644 --- a/src/modules/m_sslinfo.cpp +++ b/src/modules/m_sslinfo.cpp @@ -22,7 +22,11 @@ class SSLCertExt : public ExtensionItem { public: - SSLCertExt(Module* parent) : ExtensionItem("ssl_cert", parent) {} + SSLCertExt(Module* parent) + : ExtensionItem("ssl_cert", ExtensionItem::EXT_USER, parent) + { + } + ssl_cert* get(const Extensible* item) const { return static_cast<ssl_cert*>(get_raw(item)); diff --git a/src/modules/m_swhois.cpp b/src/modules/m_swhois.cpp index 4eb2a9cda..81abde6f7 100644 --- a/src/modules/m_swhois.cpp +++ b/src/modules/m_swhois.cpp @@ -31,7 +31,9 @@ class CommandSwhois : public Command { public: StringExtItem swhois; - CommandSwhois(Module* Creator) : Command(Creator,"SWHOIS", 2,2), swhois("swhois", Creator) + CommandSwhois(Module* Creator) + : Command(Creator, "SWHOIS", 2, 2) + , swhois("swhois", ExtensionItem::EXT_USER, Creator) { flags_needed = 'o'; syntax = "<nick> :<swhois>"; TRANSLATE2(TR_NICK, TR_TEXT); diff --git a/src/modules/m_topiclock.cpp b/src/modules/m_topiclock.cpp index 42ed6e4c1..6053bc849 100644 --- a/src/modules/m_topiclock.cpp +++ b/src/modules/m_topiclock.cpp @@ -90,7 +90,7 @@ class FlagExtItem : public ExtensionItem { public: FlagExtItem(const std::string& key, Module* owner) - : ExtensionItem(key, owner) + : ExtensionItem(key, ExtensionItem::EXT_CHANNEL, owner) { } diff --git a/src/modules/m_watch.cpp b/src/modules/m_watch.cpp index 9cb31a6d8..d0e42af6f 100644 --- a/src/modules/m_watch.cpp +++ b/src/modules/m_watch.cpp @@ -247,7 +247,7 @@ class CommandWatch : public Command return CMD_SUCCESS; } - CommandWatch(Module* parent, unsigned int &maxwatch) : Command(parent,"WATCH", 0), MAX_WATCH(maxwatch), ext("watchlist", parent) + CommandWatch(Module* parent, unsigned int &maxwatch) : Command(parent,"WATCH", 0), MAX_WATCH(maxwatch), ext("watchlist", ExtensionItem::EXT_USER, parent) { syntax = "[C|L|S]|[+|-<nick>]"; } |