diff options
author | Zdenek Prikryl <zdeny@dhcp-lab-218.englab.brq.redhat.com> | 2009-07-31 17:08:49 +0200 |
---|---|---|
committer | Zdenek Prikryl <zdeny@dhcp-lab-218.englab.brq.redhat.com> | 2009-07-31 17:08:49 +0200 |
commit | de2c473ef6cb27a080bb0491f21d1280e2c971c5 (patch) | |
tree | 7189bf00de07ea69fe29ee0a1435e7b65316a8d4 /lib/Plugins/FileTransfer.cpp | |
parent | 3f89291d3dbb6ebd28cf7aaa1cbde24b27810bfc (diff) | |
download | abrt-de2c473ef6cb27a080bb0491f21d1280e2c971c5.tar.gz abrt-de2c473ef6cb27a080bb0491f21d1280e2c971c5.tar.xz abrt-de2c473ef6cb27a080bb0491f21d1280e2c971c5.zip |
added new interface for geting plugins' settings (will be used in gui)
Diffstat (limited to 'lib/Plugins/FileTransfer.cpp')
-rw-r--r-- | lib/Plugins/FileTransfer.cpp | 39 |
1 files changed, 29 insertions, 10 deletions
diff --git a/lib/Plugins/FileTransfer.cpp b/lib/Plugins/FileTransfer.cpp index 3b7b979..1aa724d 100644 --- a/lib/Plugins/FileTransfer.cpp +++ b/lib/Plugins/FileTransfer.cpp @@ -32,7 +32,6 @@ #include "DebugDump.h" #include "ABRTException.h" -#include "PluginSettings.h" #include "CommLayerInner.h" @@ -225,32 +224,37 @@ void CFileTransfer::Run(const std::string& pActiveDir, const std::string& pArgs) void CFileTransfer::LoadSettings(const std::string& pPath) { - map_settings_t settings; + map_plugin_settings_t settings; plugin_load_settings(pPath, settings); - if (settings.find("URL")!= settings.end()) + SetSettings(settings); +} + +void CFileTransfer::SetSettings(const map_plugin_settings_t& pSettings) +{ + if (pSettings.find("URL") != pSettings.end()) { - m_sURL = settings["URL"]; + m_sURL = pSettings.find("URL")->second; } else { comm_layer_inner_warning("FileTransfer: URL not specified"); } - if (settings.find("RetryCount")!= settings.end()) + if (pSettings.find("RetryCount") != pSettings.end()) { - m_nRetryCount = atoi(settings["RetryCount"].c_str()); + m_nRetryCount = atoi(pSettings.find("RetryCount")->second.c_str()); } - if (settings.find("RetryDelay")!= settings.end()) + if (pSettings.find("RetryDelay") != pSettings.end()) { - m_nRetryDelay = atoi(settings["RetryDelay"].c_str()); + m_nRetryDelay = atoi(pSettings.find("RetryDelay")->second.c_str()); } - if (settings.find("ArchiveType")!= settings.end()) + if (pSettings.find("ArchiveType") != pSettings.end()) { /* currently supporting .tar.gz, .tar.bz2 and .zip */ - m_sArchiveType = settings["ArchiveType"]; + m_sArchiveType =pSettings.find("ArchiveType")->second; if(m_sArchiveType[0] != '.') { m_sArchiveType = "." + m_sArchiveType; @@ -258,6 +262,21 @@ void CFileTransfer::LoadSettings(const std::string& pPath) } } +map_plugin_settings_t CFileTransfer::GetSettings() +{ + map_plugin_settings_t ret; + std::stringstream ss; + ret["URL"] = m_sURL; + ss << m_nRetryCount; + ret["RetryCount"] = ss.str(); + ss.str(""); + ss << m_nRetryDelay; + ret["RetryDelay"] = ss.str(); + ret["ArchiveType"] = m_sArchiveType; + + return ret; +} + PLUGIN_INFO(ACTION, CFileTransfer, "FileTransfer", |