summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorZdenek Prikryl <zdeny@dhcp-lab-218.englab.brq.redhat.com>2009-02-04 17:05:58 +0100
committerZdenek Prikryl <zdeny@dhcp-lab-218.englab.brq.redhat.com>2009-02-04 17:05:58 +0100
commit4a77662735ad54742851339c52a921b8313a8a81 (patch)
treed3cec98b8abfa592200619f3f6e8be481dc485c2 /lib
parent0390d41b39350a361735e8a9f712cc25f3adaab4 (diff)
downloadabrt-4a77662735ad54742851339c52a921b8313a8a81.tar.gz
abrt-4a77662735ad54742851339c52a921b8313a8a81.tar.xz
abrt-4a77662735ad54742851339c52a921b8313a8a81.zip
tabs are replaced by space
new plugin interface
Diffstat (limited to 'lib')
-rw-r--r--lib/Plugins/Mailx.cpp62
-rw-r--r--lib/Plugins/Mailx.h38
2 files changed, 51 insertions, 49 deletions
diff --git a/lib/Plugins/Mailx.cpp b/lib/Plugins/Mailx.cpp
index 7f4b7a76..809dbd23 100644
--- a/lib/Plugins/Mailx.cpp
+++ b/lib/Plugins/Mailx.cpp
@@ -26,49 +26,49 @@
#define MAILX_SUBJECT "CrashCatcher automated bug report"
CMailx::CMailx() :
- m_sEmailFrom(""),
- m_sEmailTo(""),
- m_sParameters()
+ m_sEmailFrom(""),
+ m_sEmailTo(""),
+ m_sParameters()
{}
void CMailx::SendEmail(const std::string& pText)
{
- FILE* command;
- std::string mailx_command = MAILX_COMMAND + m_sParameters +
- " -s " + MAILX_SUBJECT +
- " -r " + m_sEmailTo + " " + m_sEmailFrom;
+ FILE* command;
+ std::string mailx_command = MAILX_COMMAND + m_sParameters +
+ " -s " + MAILX_SUBJECT +
+ " -r " + m_sEmailTo + " " + m_sEmailFrom;
- command = popen(mailx_command.c_str(), "w");
- if (!command)
- {
- throw std::string("CMailx::SendEmail: Can not execute mailx.");
- }
- if (fputs(pText.c_str(), command) == -1)
- {
- throw std::string("CMailx::SendEmail: Can not send data.");
- }
- pclose(command);
+ command = popen(mailx_command.c_str(), "w");
+ if (!command)
+ {
+ throw std::string("CMailx::SendEmail: Can not execute mailx.");
+ }
+ if (fputs(pText.c_str(), command) == -1)
+ {
+ throw std::string("CMailx::SendEmail: Can not send data.");
+ }
+ pclose(command);
}
void CMailx::Report(const std::string& pDebugDumpPath)
{
- SendEmail("Nejakej zbesilej report.");
+ SendEmail("Nejakej zbesilej report.");
}
-void CMailx::Init(const map_settings_t& pSettings)
+void CMailx::SetSettings(const map_settings_t& pSettings)
{
- if (pSettings.find("Email_From")!= pSettings.end())
- {
- m_sEmailFrom = pSettings.find("Email_From")->second;
- }
- if (pSettings.find("Email_To")!= pSettings.end())
- {
- m_sEmailFrom = pSettings.find("Email_To")->second;
- }
- if (pSettings.find("Parameters")!= pSettings.end())
- {
- m_sParameters = pSettings.find("Parameters")->second;
- }
+ if (pSettings.find("Email_From")!= pSettings.end())
+ {
+ m_sEmailFrom = pSettings.find("Email_From")->second;
+ }
+ if (pSettings.find("Email_To")!= pSettings.end())
+ {
+ m_sEmailFrom = pSettings.find("Email_To")->second;
+ }
+ if (pSettings.find("Parameters")!= pSettings.end())
+ {
+ m_sParameters = pSettings.find("Parameters")->second;
+ }
}
diff --git a/lib/Plugins/Mailx.h b/lib/Plugins/Mailx.h
index e1463ea0..4a1d61b3 100644
--- a/lib/Plugins/Mailx.h
+++ b/lib/Plugins/Mailx.h
@@ -29,28 +29,30 @@
class CMailx : public CReporter
{
- private:
- std::string m_sEmailFrom;
- std::string m_sEmailTo;
- std::string m_sParameters;
-
- void SendEmail(const std::string& pText);
-
- public:
- CMailx();
- virtual ~CMailx() {}
- void Init(const map_settings_t& pSettings);
- void DeInit() {}
- void Report(const std::string& pDebugDumpPath);
+ private:
+ std::string m_sEmailFrom;
+ std::string m_sEmailTo;
+ std::string m_sParameters;
+
+ void SendEmail(const std::string& pText);
+
+ public:
+ CMailx();
+ virtual ~CMailx() {}
+ void Init() {}
+ void DeInit() {}
+ void SetSettings(const map_settings_t& pSettings);
+
+ void Report(const std::string& pDebugDumpPath);
};
PLUGIN_INFO(REPORTER,
- "Mailx",
- "0.0.1",
- "Sends an email with a report via mailx command",
- "zprikryl@redhat.com",
- "https://fedorahosted.org/crash-catcher/wiki");
+ "Mailx",
+ "0.0.1",
+ "Sends an email with a report via mailx command",
+ "zprikryl@redhat.com",
+ "https://fedorahosted.org/crash-catcher/wiki");
PLUGIN_INIT(CMailx);