summaryrefslogtreecommitdiffstats
path: root/lib/Utils/make_descr.cpp
diff options
context:
space:
mode:
authorJiri Moskovcak <jmoskovc@localhost.localdomain>2009-11-19 10:32:22 +0100
committerJiri Moskovcak <jmoskovc@localhost.localdomain>2009-11-19 10:32:22 +0100
commit483f24b17ccfa0aaab8dd9d50b3228475d259bcf (patch)
tree4f1dd181cc3fbb9b0d3cbad4b6d816c4f6ff537a /lib/Utils/make_descr.cpp
parent9274bccfbb551dcd77098624f7a763cd235a01f0 (diff)
parentc18c9c5a0493bca0c978911460da67ef5e59b442 (diff)
downloadabrt-483f24b17ccfa0aaab8dd9d50b3228475d259bcf.tar.gz
abrt-483f24b17ccfa0aaab8dd9d50b3228475d259bcf.tar.xz
abrt-483f24b17ccfa0aaab8dd9d50b3228475d259bcf.zip
Merge branch 'master' of ssh://git.fedorahosted.org/git/abrt
Diffstat (limited to 'lib/Utils/make_descr.cpp')
-rw-r--r--lib/Utils/make_descr.cpp71
1 files changed, 71 insertions, 0 deletions
diff --git a/lib/Utils/make_descr.cpp b/lib/Utils/make_descr.cpp
index 0c09614..46dd48c 100644
--- a/lib/Utils/make_descr.cpp
+++ b/lib/Utils/make_descr.cpp
@@ -2,6 +2,15 @@
//#include "abrt_types.h"
#include "CrashTypes.h"
#include "DebugDump.h" /* FILENAME_ARCHITECTURE etc */
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+#if ENABLE_NLS
+# include <libintl.h>
+# define _(S) gettext(S)
+#else
+# define _(S) (S)
+#endif
using namespace std;
@@ -131,3 +140,65 @@ string make_description_logger(const map_crash_report_t& pCrashReport)
return description;
}
+
+/* This needs more work to make the result less ugly */
+string make_description_catcut(const map_crash_report_t& pCrashReport)
+{
+ map_crash_report_t::const_iterator end = pCrashReport.end();
+ map_crash_report_t::const_iterator it;
+
+ string howToReproduce;
+ it = pCrashReport.find(CD_REPRODUCE);
+ if (it != end)
+ {
+ howToReproduce = "\n\nHow to reproduce\n"
+ "-----\n";
+ howToReproduce += it->second[CD_CONTENT];
+ }
+ string comment;
+ it = pCrashReport.find(CD_COMMENT);
+ if (it != end)
+ {
+ comment = "\n\nComment\n"
+ "-----\n";
+ comment += it->second[CD_CONTENT];
+ }
+
+ string pDescription = "\nabrt "VERSION" detected a crash.\n";
+ pDescription += howToReproduce;
+ pDescription += comment;
+ pDescription += "\n\nAdditional information\n"
+ "======\n";
+
+ for (it = pCrashReport.begin(); it != end; it++)
+ {
+ if (it->second[CD_TYPE] == CD_TXT)
+ {
+ if (it->first != CD_UUID
+ && it->first != FILENAME_ARCHITECTURE
+ && it->first != FILENAME_RELEASE
+ && it->first != CD_REPRODUCE
+ && it->first != CD_COMMENT
+ ) {
+ pDescription += '\n';
+ pDescription += it->first;
+ pDescription += "\n-----\n";
+ pDescription += it->second[CD_CONTENT];
+ pDescription += "\n\n";
+ }
+ }
+ else if (it->second[CD_TYPE] == CD_ATT)
+ {
+ pDescription += "\n\nAttached files\n"
+ "----\n";
+ pDescription += it->first;
+ pDescription += '\n';
+ }
+ else if (it->second[CD_TYPE] == CD_BIN)
+ {
+ error_msg(_("Binary file %s will not be reported"), it->first.c_str());
+ }
+ }
+
+ return pDescription;
+}