summaryrefslogtreecommitdiff
path: root/modules/nickserv/ns_cert.cpp
diff options
context:
space:
mode:
authorSadie Powell <sadie@witchery.services>2024-02-21 13:11:47 +0000
committerSadie Powell <sadie@witchery.services>2024-02-21 13:30:16 +0000
commit89594d455718432a24930a7cf97c26daaaf49472 (patch)
tree9471702d551a26cdbc5b26203496fb39d7a6f22c /modules/nickserv/ns_cert.cpp
parentb478a1cb5351180cd39b5a01e1891bfd30af1659 (diff)
Add a method to the ns_cert API for replacing a certificate.
This will be used for upgrading certificate fingerprints when the InspIRCd 1206 protocol support is added.
Diffstat (limited to 'modules/nickserv/ns_cert.cpp')
-rw-r--r--modules/nickserv/ns_cert.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/modules/nickserv/ns_cert.cpp b/modules/nickserv/ns_cert.cpp
index 389b49cf5..17cf1fb96 100644
--- a/modules/nickserv/ns_cert.cpp
+++ b/modules/nickserv/ns_cert.cpp
@@ -103,6 +103,19 @@ public:
}
}
+ void ReplaceCert(const Anope::string &oldentry, const Anope::string &newentry) override
+ {
+ auto it = std::find(this->certs.begin(), this->certs.end(), oldentry);
+ if (it == this->certs.end())
+ return; // We can't replace a non-existent cert.
+
+ FOREACH_MOD(OnNickEraseCert, (this->nc, oldentry));
+ certmap.erase(oldentry);
+ *it = newentry;
+ certmap[newentry] = nc;
+ FOREACH_MOD(OnNickAddCert, (this->nc, newentry));
+ }
+
/** Clears the entire nick's cert list
*
* Deletes all the memory allocated in the certificate list vector and then clears the vector.