]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Add SSL flag to WHO response
authorlinuxdaemon <linuxdaemon@snoonet.org>
Tue, 12 Mar 2019 17:43:34 +0000 (12:43 -0500)
committerPeter Powell <petpow@saberuk.com>
Tue, 12 Mar 2019 18:36:23 +0000 (18:36 +0000)
src/modules/m_sslinfo.cpp

index 21857b3d955455e5b2150c60dc25a6bbd49a954c..1b1ce9eaa090c059a89d95a8bcd862e473453771 100644 (file)
@@ -21,6 +21,7 @@
 #include "modules/ssl.h"
 #include "modules/webirc.h"
 #include "modules/whois.h"
+#include "modules/who.h"
 
 enum
 {
@@ -184,6 +185,7 @@ class ModuleSSLInfo
        : public Module
        , public WebIRC::EventListener
        , public Whois::EventListener
+       , public Who::EventListener
 {
  private:
        CommandSSLInfo cmd;
@@ -197,6 +199,7 @@ class ModuleSSLInfo
        ModuleSSLInfo()
                : WebIRC::EventListener(this)
                , Whois::EventListener(this)
+               , Who::EventListener(this)
                , cmd(this)
        {
        }
@@ -218,6 +221,19 @@ class ModuleSSLInfo
                }
        }
 
+       ModResult OnWhoLine(const Who::Request& request, LocalUser* source, User* user, Membership* memb, Numeric::Numeric& numeric) CXX11_OVERRIDE
+       {
+               size_t flag_index;
+               if (!request.GetFieldIndex('f', flag_index))
+                       return MOD_RES_PASSTHRU;
+
+               ssl_cert* cert = cmd.sslapi.GetCertificate(user);
+               if (cert)
+                       numeric.GetParams()[flag_index].push_back('s');
+
+               return MOD_RES_PASSTHRU;
+       }
+
        ModResult OnPreCommand(std::string& command, CommandBase::Params& parameters, LocalUser* user, bool validated) CXX11_OVERRIDE
        {
                if ((command == "OPER") && (validated))