diff options
| author | 2022-09-18 22:56:39 +0100 | |
|---|---|---|
| committer | 2022-09-19 23:47:13 +0100 | |
| commit | 17950178cdf55c59cf7c44dd9f583bc1d76c60ef (patch) | |
| tree | b4948210dfd240c9cf4bdb1aadab1448f51ef6f5 /src/modules | |
| parent | Merge branch 'insp3' into master. (diff) | |
Avoid creating duplicate account API instances in ircv3_accounttag.
Diffstat (limited to 'src/modules')
| -rw-r--r-- | src/modules/m_ircv3_accounttag.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/modules/m_ircv3_accounttag.cpp b/src/modules/m_ircv3_accounttag.cpp index b4087fd8c..eb3cf8b72 100644 --- a/src/modules/m_ircv3_accounttag.cpp +++ b/src/modules/m_ircv3_accounttag.cpp @@ -27,7 +27,7 @@ class AccountTag final : public IRCv3::CapTag<AccountTag> { private: - Account::API accountapi; + Account::API& accountapi; public: const std::string* GetValue(const ClientProtocol::Message& msg) const @@ -39,9 +39,9 @@ public: return accountapi->GetAccountName(user); } - AccountTag(Module* mod) + AccountTag(Module* mod, Account::API& api) : IRCv3::CapTag<AccountTag>(mod, "account-tag", "account") - , accountapi(mod) + , accountapi(api) { } }; @@ -50,14 +50,14 @@ class AccountIdTag final : public ClientProtocol::MessageTagProvider { private: - Account::API accountapi; + Account::API& accountapi; AccountTag& acctag; CTCTags::CapReference ctctagcap; public: - AccountIdTag(Module* mod, AccountTag& tag) + AccountIdTag(Module* mod, AccountTag& tag, Account::API& api) : ClientProtocol::MessageTagProvider(mod) - , accountapi(mod) + , accountapi(api) , acctag(tag) , ctctagcap(mod) { @@ -84,14 +84,16 @@ class ModuleIRCv3AccountTag final : public Module { private: + Account::API accountapi; AccountTag tag; AccountIdTag idtag; public: ModuleIRCv3AccountTag() : Module(VF_VENDOR, "Provides the IRCv3 account-tag client capability.") - , tag(this) - , idtag(this, tag) + , accountapi(this) + , tag(this, accountapi) + , idtag(this, tag, accountapi) { } }; |
