]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_sslinfo.cpp
SVSNICK should not translate nicks to UIDs
[user/henk/code/inspircd.git] / src / modules / m_sslinfo.cpp
index 578b07c22a268ccd84384036fb953977d09bfcbb..7354b16f755c90760fae752d08258272967b082b 100644 (file)
@@ -83,7 +83,7 @@ class CommandSSLInfo : public Command
 
        CmdResult Handle (const std::vector<std::string> &parameters, User *user)
        {
-               User* target = ServerInstance->FindNick(parameters[0]);
+               User* target = ServerInstance->FindNickOnly(parameters[0]);
 
                if (!target)
                {
@@ -130,8 +130,8 @@ class ModuleSSLInfo : public Module
 
                ServerInstance->Extensions.Register(&cmd.CertExt);
 
-               Implementation eventlist[] = { I_OnWhois, I_OnPreCommand, I_OnSetConnectClass, I_OnUserConnect };
-               ServerInstance->Modules->Attach(eventlist, this, 4);
+               Implementation eventlist[] = { I_OnWhois, I_OnPreCommand, I_OnSetConnectClass, I_OnUserConnect, I_OnPostConnect };
+               ServerInstance->Modules->Attach(eventlist, this, 5);
        }
 
        Version GetVersion()
@@ -144,7 +144,7 @@ class ModuleSSLInfo : public Module
                ssl_cert* cert = cmd.CertExt.get(dest);
                if (cert)
                {
-                       ServerInstance->SendWhoisLine(source, dest, 320, "%s %s :is using a secure connection", source->nick.c_str(), dest->nick.c_str());
+                       ServerInstance->SendWhoisLine(source, dest, 671, "%s %s :is using a secure connection", source->nick.c_str(), dest->nick.c_str());
                        bool operonlyfp = ServerInstance->Config->ConfValue("sslinfo")->getBool("operonly");
                        if ((!operonlyfp || source == dest || IS_OPER(source)) && !cert->fingerprint.empty())
                                ServerInstance->SendWhoisLine(source, dest, 276, "%s %s :has client certificate fingerprint %s",
@@ -205,14 +205,19 @@ class ModuleSSLInfo : public Module
                if (!req.cert)
                        return;
                cmd.CertExt.set(user, req.cert);
-               if (req.cert->fingerprint.empty())
+       }
+
+       void OnPostConnect(User* user)
+       {
+               ssl_cert *cert = cmd.CertExt.get(user);
+               if (!cert || cert->fingerprint.empty())
                        return;
                // find an auto-oper block for this user
                for(OperIndex::iterator i = ServerInstance->Config->oper_blocks.begin(); i != ServerInstance->Config->oper_blocks.end(); i++)
                {
                        OperInfo* ifo = i->second;
                        std::string fp = ifo->oper_block->getString("fingerprint");
-                       if (fp == req.cert->fingerprint && ifo->oper_block->getBool("autologin"))
+                       if (fp == cert->fingerprint && ifo->oper_block->getBool("autologin"))
                                user->Oper(ifo);
                }
        }