diff options
author | Attila Molnar <attilamolnar@hush.com> | 2015-01-22 12:14:25 +0100 |
---|---|---|
committer | Attila Molnar <attilamolnar@hush.com> | 2015-01-22 12:14:25 +0100 |
commit | 74d469af3937518f7619a78bc2fe99a4d662deea (patch) | |
tree | 56f870978ce2befed64805ce6574261bac9c6ce9 /src | |
parent | 38b22990eae47525f4e8064a29e585a89788ee58 (diff) | |
parent | 1b957ed3a9d79a0cbc71e79acca82d893b40f8ac (diff) |
Merge branch 'master+exttype' into master+no-rtti
Diffstat (limited to 'src')
32 files changed, 77 insertions, 44 deletions
diff --git a/src/base.cpp b/src/base.cpp index 682899132..67b136ec8 100644 --- a/src/base.cpp +++ b/src/base.cpp @@ -95,7 +95,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) { } @@ -207,7 +209,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) { } @@ -224,8 +227,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() { @@ -238,7 +243,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) { } @@ -270,7 +276,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..aac0b9ce0 100644 --- a/src/modules/m_services_account.cpp +++ b/src/modules/m_services_account.cpp @@ -106,15 +106,13 @@ class AccountExtItemImpl : public AccountExtItem { public: AccountExtItemImpl(Module* mod) - : AccountExtItem("accountname", mod) + : AccountExtItem("accountname", ExtensionItem::EXT_USER, mod) { } void unserialize(SerializeFormat format, Extensible* container, const std::string& value) { - User* user = dynamic_cast<User*>(container); - if (!user) - return; + User* user = static_cast<User*>(container); StringExtItem::unserialize(format, container, value); if (!value.empty()) 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_spanningtree/metadata.cpp b/src/modules/m_spanningtree/metadata.cpp index 13ccabc35..f758754b4 100644 --- a/src/modules/m_spanningtree/metadata.cpp +++ b/src/modules/m_spanningtree/metadata.cpp @@ -49,7 +49,7 @@ CmdResult CommandMetadata::Handle(User* srcuser, std::vector<std::string>& param std::string value = params.size() < 4 ? "" : params[3]; ExtensionItem* item = ServerInstance->Extensions.GetItem(params[2]); - if (item) + if ((item) && (item->type == ExtensionItem::EXT_CHANNEL)) item->unserialize(FORMAT_NETWORK, c, value); FOREACH_MOD(OnDecodeMetaData, (c,params[2],value)); } @@ -61,7 +61,7 @@ CmdResult CommandMetadata::Handle(User* srcuser, std::vector<std::string>& param ExtensionItem* item = ServerInstance->Extensions.GetItem(params[1]); std::string value = params.size() < 3 ? "" : params[2]; - if (item) + if ((item) && (item->type == ExtensionItem::EXT_USER)) item->unserialize(FORMAT_NETWORK, u, value); FOREACH_MOD(OnDecodeMetaData, (u,params[1],value)); } 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>]"; } |