aboutsummaryrefslogtreecommitdiffstats
path: root/src/init.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/init.cpp')
-rw-r--r--src/init.cpp33
1 files changed, 31 insertions, 2 deletions
diff --git a/src/init.cpp b/src/init.cpp
index 4f441c29..fffaaa1b 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -23,9 +23,25 @@
*/
#include <boost/date_time.hpp>
+#include <vmime/vmime.hpp>
#include "ui/settings/GlobalSettingStation.h"
+std::vector<boost::filesystem::path> get_files_of_directory(
+ const boost::filesystem::path& _path) {
+ namespace fs = boost::filesystem;
+ std::vector<fs::path> path_list;
+ if (!_path.empty()) {
+ fs::recursive_directory_iterator end;
+
+ for (fs::recursive_directory_iterator i(_path); i != end; ++i) {
+ const fs::path cp = (*i);
+ path_list.push_back(cp);
+ }
+ }
+ return path_list;
+}
+
void init_logging() {
using namespace boost::posix_time;
using namespace boost::gregorian;
@@ -49,7 +65,20 @@ void init_logging() {
el::Loggers::reconfigureLogger("default", defaultConf);
- LOG(INFO) << _("Logfile Path") << logfile_path;
+ LOG(INFO) << _("logfile Path") << logfile_path;
+}
+
+void init_certs() {
+ std::vector<vmime::shared_ptr<vmime::security::cert::X509Certificate>>
+ root_certs;
+ auto cert_file_paths = get_files_of_directory(
+ GpgFrontend::UI::GlobalSettingStation::GetInstance().GetCertsDir());
+
+ auto& _instance = GpgFrontend::UI::GlobalSettingStation::GetInstance();
+ for (const auto& cert_file_path : cert_file_paths) {
+ _instance.AddRootCert(cert_file_path);
+ }
+ LOG(INFO) << _("root certs loaded") << _instance.GetRootCerts().size();
}
void init_locale() {
@@ -72,7 +101,7 @@ void init_locale() {
// read from settings file
std::string lang;
if (!general.lookupValue("lang", lang)) {
- LOG(ERROR) << _("Could not read properly from configure file");
+ LOG(ERROR) << _("could not read properly from configure file");
};
LOG(INFO) << "lang from settings" << lang;