summaryrefslogtreecommitdiffstats
path: root/lib/Utils/make_descr.cpp
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2009-11-19 10:23:12 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2009-11-19 10:23:12 +0100
commitc18c9c5a0493bca0c978911460da67ef5e59b442 (patch)
treefc3e94ffddbc26bf27e9757b12d8e95fef280ac7 /lib/Utils/make_descr.cpp
parent83aea71df4761ec10c0d947055e65102bcace489 (diff)
downloadabrt-c18c9c5a0493bca0c978911460da67ef5e59b442.tar.gz
abrt-c18c9c5a0493bca0c978911460da67ef5e59b442.tar.xz
abrt-c18c9c5a0493bca0c978911460da67ef5e59b442.zip
move Catcut's description generation to lib/Utils/make_descr.cpp
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
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 0c096143..46dd48c8 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;
+}