summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2011-04-19 16:47:01 (GMT)
committerRemko Tronçon <git@el-tramo.be>2011-04-26 18:38:51 (GMT)
commit37de16e21bf73d1dea16343f04d061d3cb389acf (patch)
tree2a618ae3ca054af895f1b515fe58825de938d3fe /Swift/Controllers/Storages/CertificateMemoryStorage.cpp
parent37567ebaa72cfc26e6cf49179eb988594c488c4b (diff)
downloadswift-37de16e21bf73d1dea16343f04d061d3cb389acf.zip
swift-37de16e21bf73d1dea16343f04d061d3cb389acf.tar.bz2
Added CertificateMemoryStorage.
Diffstat (limited to 'Swift/Controllers/Storages/CertificateMemoryStorage.cpp')
-rw-r--r--Swift/Controllers/Storages/CertificateMemoryStorage.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/Swift/Controllers/Storages/CertificateMemoryStorage.cpp b/Swift/Controllers/Storages/CertificateMemoryStorage.cpp
new file mode 100644
index 0000000..71d7c4a
--- /dev/null
+++ b/Swift/Controllers/Storages/CertificateMemoryStorage.cpp
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2011 Remko Tronçon
+ * Licensed under the GNU General Public License v3.
+ * See Documentation/Licenses/GPLv3.txt for more information.
+ */
+
+#include <Swift/Controllers/Storages/CertificateMemoryStorage.h>
+
+#include <Swiften/Base/foreach.h>
+
+using namespace Swift;
+
+CertificateMemoryStorage::CertificateMemoryStorage() {
+}
+
+bool CertificateMemoryStorage::hasCertificate(Certificate::ref certificate) const {
+ foreach(Certificate::ref storedCert, certificates) {
+ if (storedCert->toDER() == certificate->toDER()) {
+ return true;
+ }
+ }
+ return false;
+}
+
+void CertificateMemoryStorage::addCertificate(Certificate::ref certificate) {
+ certificates.push_back(certificate);
+}