diff options
author | Attila Molnar <attilamolnar@hush.com> | 2015-05-04 13:24:48 +0200 |
---|---|---|
committer | Attila Molnar <attilamolnar@hush.com> | 2015-05-04 13:24:48 +0200 |
commit | 4711113dff7fc33c96f95f417f2813f28c690e01 (patch) | |
tree | 7ccecb9e52f6c13c233a3efe312410a1c8e526a0 /src/modules/m_sslinfo.cpp | |
parent | 8aa03e455e14ea85cdee65527565975ddf558b88 (diff) | |
parent | 68bb6a67459298ca08eb18b60794619ddf782c77 (diff) |
Merge branch 'master+whoiscontext'
Diffstat (limited to 'src/modules/m_sslinfo.cpp')
-rw-r--r-- | src/modules/m_sslinfo.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/modules/m_sslinfo.cpp b/src/modules/m_sslinfo.cpp index f861f1236..523d52abb 100644 --- a/src/modules/m_sslinfo.cpp +++ b/src/modules/m_sslinfo.cpp @@ -139,14 +139,16 @@ class UserCertificateAPIImpl : public UserCertificateAPIBase } }; -class ModuleSSLInfo : public Module +class ModuleSSLInfo : public Module, public Whois::EventListener { CommandSSLInfo cmd; UserCertificateAPIImpl APIImpl; public: ModuleSSLInfo() - : cmd(this), APIImpl(this, cmd.CertExt) + : Whois::EventListener(this) + , cmd(this) + , APIImpl(this, cmd.CertExt) { } @@ -155,16 +157,15 @@ class ModuleSSLInfo : public Module return Version("SSL Certificate Utilities", VF_VENDOR); } - void OnWhois(User* source, User* dest) CXX11_OVERRIDE + void OnWhois(Whois::Context& whois) CXX11_OVERRIDE { - ssl_cert* cert = cmd.CertExt.get(dest); + ssl_cert* cert = cmd.CertExt.get(whois.GetTarget()); if (cert) { - ServerInstance->SendWhoisLine(source, dest, 671, "%s :is using a secure connection", dest->nick.c_str()); + whois.SendLine(671, ":is using a secure connection"); bool operonlyfp = ServerInstance->Config->ConfValue("sslinfo")->getBool("operonly"); - if ((!operonlyfp || source == dest || source->IsOper()) && !cert->fingerprint.empty()) - ServerInstance->SendWhoisLine(source, dest, 276, "%s :has client certificate fingerprint %s", - dest->nick.c_str(), cert->fingerprint.c_str()); + if ((!operonlyfp || whois.IsSelfWhois() || whois.GetSource()->IsOper()) && !cert->fingerprint.empty()) + whois.SendLine(276, ":has client certificate fingerprint %s", cert->fingerprint.c_str()); } } |