summaryrefslogtreecommitdiffstats
path: root/lib/Plugins/Mailx.cpp
diff options
context:
space:
mode:
authorJiri Moskovcak <jmoskovc@redhat.com>2009-02-12 12:34:25 +0100
committerJiri Moskovcak <jmoskovc@redhat.com>2009-02-12 12:34:25 +0100
commit53821dddf0b6ee66dc5f0684b17c541c157656ec (patch)
tree00dcb130b6fd32ef137cd7b139bbebfeb0c060b4 /lib/Plugins/Mailx.cpp
parent356da89a4e2e6e50ceade12f286d104fe1c17eae (diff)
parentc93222d1407ede085833d3a91bfeda5f0f910eb4 (diff)
downloadabrt-53821dddf0b6ee66dc5f0684b17c541c157656ec.tar.gz
abrt-53821dddf0b6ee66dc5f0684b17c541c157656ec.tar.xz
abrt-53821dddf0b6ee66dc5f0684b17c541c157656ec.zip
Merge branch 'master' of git://git.fedorahosted.org/git/crash-catcher
Diffstat (limited to 'lib/Plugins/Mailx.cpp')
-rw-r--r--lib/Plugins/Mailx.cpp68
1 files changed, 60 insertions, 8 deletions
diff --git a/lib/Plugins/Mailx.cpp b/lib/Plugins/Mailx.cpp
index 809dbd2..cb26e39 100644
--- a/lib/Plugins/Mailx.cpp
+++ b/lib/Plugins/Mailx.cpp
@@ -21,23 +21,27 @@
#include "Mailx.h"
#include <stdio.h>
+#include <sstream>
+#include "DebugDump.h"
-#define MAILX_COMMAND "mailx"
-#define MAILX_SUBJECT "CrashCatcher automated bug report"
+#define MAILX_COMMAND "/bin/mailx"
+#define MAILX_SUBJECT "\"CrashCatcher automated bug report\""
CMailx::CMailx() :
m_sEmailFrom(""),
m_sEmailTo(""),
- m_sParameters()
+ m_sParameters(""),
+ m_sAttachments("")
{}
void CMailx::SendEmail(const std::string& pText)
{
FILE* command;
- std::string mailx_command = MAILX_COMMAND + m_sParameters +
+ std::string mailx_command = MAILX_COMMAND + m_sAttachments +
+ " " + m_sParameters +
" -s " + MAILX_SUBJECT +
- " -r " + m_sEmailTo + " " + m_sEmailFrom;
+ " -r " + m_sEmailFrom + " " + m_sEmailTo;
command = popen(mailx_command.c_str(), "w");
if (!command)
@@ -52,9 +56,57 @@ void CMailx::SendEmail(const std::string& pText)
}
-void CMailx::Report(const std::string& pDebugDumpPath)
+void CMailx::Report(const report_t& pReport)
{
- SendEmail("Nejakej zbesilej report.");
+ std::stringstream ss;
+
+ ss << "Common information" << std::endl;
+ ss << "==================" << std::endl << std::endl;
+ ss << "Architecture" << std::endl;
+ ss << "------------" << std::endl;
+ ss << pReport.m_sArchitecture << std::endl << std::endl;
+ ss << "Kernel version" << std::endl;
+ ss << "--------------" << std::endl;
+ ss << pReport.m_sKernel << std::endl << std::endl;
+ ss << "Package" << std::endl;
+ ss << "-------" << std::endl;
+ ss << pReport.m_sPackage << std::endl << std::endl;
+ ss << "Executable" << std::endl;
+ ss << "----------" << std::endl;
+ ss << pReport.m_sExecutable << std::endl << std::endl;
+ ss << "CmdLine" << std::endl;
+ ss << "----------" << std::endl;
+ ss << pReport.m_sCmdLine << std::endl << std::endl;
+ ss << "Created report" << std::endl;
+ ss << "==============" << std::endl;
+ ss << "Text reports" << std::endl;
+ ss << "==============" << std::endl;
+ if (pReport.m_sTextData1 != "")
+ {
+ ss << "Text Data 1" << std::endl;
+ ss << "-----------" << std::endl;
+ ss << pReport.m_sTextData1 << std::endl << std::endl;
+ }
+ if (pReport.m_sTextData2 != "")
+ {
+ ss << "Text Data 2" << std::endl;
+ ss << "-----------" << std::endl;
+ ss << pReport.m_sTextData2 << std::endl << std::endl;
+ }
+ ss << "Binary reports" << std::endl;
+ ss << "==============" << std::endl;
+ ss << "See the attachment[s]" << std::endl;
+
+ if (pReport.m_bBinaryData1 != "")
+ {
+ m_sAttachments = " -a " + pReport.m_bBinaryData1;
+ }
+ if (pReport.m_bBinaryData2 != "")
+ {
+ m_sAttachments = " -a " + pReport.m_bBinaryData2;
+ }
+
+ SendEmail(ss.str());
}
void CMailx::SetSettings(const map_settings_t& pSettings)
@@ -65,7 +117,7 @@ void CMailx::SetSettings(const map_settings_t& pSettings)
}
if (pSettings.find("Email_To")!= pSettings.end())
{
- m_sEmailFrom = pSettings.find("Email_To")->second;
+ m_sEmailTo = pSettings.find("Email_To")->second;
}
if (pSettings.find("Parameters")!= pSettings.end())
{