summaryrefslogtreecommitdiffstats
path: root/lib/Plugins/Bugzilla.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Plugins/Bugzilla.cpp')
-rw-r--r--lib/Plugins/Bugzilla.cpp48
1 files changed, 27 insertions, 21 deletions
diff --git a/lib/Plugins/Bugzilla.cpp b/lib/Plugins/Bugzilla.cpp
index f963eb9..aafa019 100644
--- a/lib/Plugins/Bugzilla.cpp
+++ b/lib/Plugins/Bugzilla.cpp
@@ -32,8 +32,8 @@ struct ctx: public abrt_xmlrpc_conn {
int32_t check_uuid_in_bugzilla(const char* component, const char* UUID);
bool check_cc_and_reporter(uint32_t bug_id, const char* login);
void add_plus_one_cc(uint32_t bug_id, const char* login);
- uint32_t new_bug(const map_crash_report_t& pCrashReport);
- void add_attachments(const char* bug_id_str, const map_crash_report_t& pCrashReport);
+ uint32_t new_bug(const map_crash_data_t& pCrashData);
+ void add_attachments(const char* bug_id_str, const map_crash_data_t& pCrashData);
};
void ctx::login(const char* login, const char* passwd)
@@ -278,22 +278,22 @@ int32_t ctx::check_uuid_in_bugzilla(const char* component, const char* UUID)
return -1;
}
-uint32_t ctx::new_bug(const map_crash_report_t& pCrashReport)
+uint32_t ctx::new_bug(const map_crash_data_t& pCrashData)
{
xmlrpc_env env;
xmlrpc_env_init(&env);
- std::string package = pCrashReport.find(FILENAME_PACKAGE)->second[CD_CONTENT];
- std::string component = pCrashReport.find(FILENAME_COMPONENT)->second[CD_CONTENT];
- std::string release = pCrashReport.find(FILENAME_RELEASE)->second[CD_CONTENT];
- std::string arch = pCrashReport.find(FILENAME_ARCHITECTURE)->second[CD_CONTENT];
- std::string uuid = pCrashReport.find(CD_UUID)->second[CD_CONTENT];
+ const std::string& package = get_crash_data_item_content(pCrashData, FILENAME_PACKAGE);
+ const std::string& component = get_crash_data_item_content(pCrashData, FILENAME_COMPONENT);
+ const std::string& release = get_crash_data_item_content(pCrashData, FILENAME_RELEASE);
+ const std::string& arch = get_crash_data_item_content(pCrashData, FILENAME_ARCHITECTURE);
+ const std::string& uuid = get_crash_data_item_content(pCrashData, CD_UUID);
std::string summary = "[abrt] crash in " + package;
std::string status_whiteboard = "abrt_hash:" + uuid;
std::string description = "abrt "VERSION" detected a crash.\n\n";
- description += make_description_bz(pCrashReport);
+ description += make_description_bz(pCrashData);
std::string product;
std::string version;
@@ -346,15 +346,15 @@ uint32_t ctx::new_bug(const map_crash_report_t& pCrashReport)
return bug_id;
}
-void ctx::add_attachments(const char* bug_id_str, const map_crash_report_t& pCrashReport)
+void ctx::add_attachments(const char* bug_id_str, const map_crash_data_t& pCrashData)
{
xmlrpc_env env;
xmlrpc_env_init(&env);
xmlrpc_value* result = NULL;
- map_crash_report_t::const_iterator it = pCrashReport.begin();
- for (; it != pCrashReport.end(); it++)
+ map_crash_data_t::const_iterator it = pCrashData.begin();
+ for (; it != pCrashData.end(); it++)
{
const std::string &filename = it->first;
const std::string &type = it->second[CD_TYPE];
@@ -404,7 +404,7 @@ CReporterBugzilla::CReporterBugzilla() :
CReporterBugzilla::~CReporterBugzilla()
{}
-std::string CReporterBugzilla::Report(const map_crash_report_t& pCrashReport,
+std::string CReporterBugzilla::Report(const map_crash_data_t& pCrashData,
const map_plugin_settings_t& pSettings,
const char *pArgs)
{
@@ -433,8 +433,8 @@ std::string CReporterBugzilla::Report(const map_crash_report_t& pCrashReport,
NoSSLVerify = m_bNoSSLVerify;
}
- std::string component = pCrashReport.find(FILENAME_COMPONENT)->second[CD_CONTENT];
- std::string uuid = pCrashReport.find(CD_UUID)->second[CD_CONTENT];
+ const std::string& component = get_crash_data_item_content(pCrashData, FILENAME_COMPONENT);
+ const std::string& uuid = get_crash_data_item_content(pCrashData, CD_UUID);
try
{
ctx bz_server(BugzillaXMLRPC.c_str(), NoSSLVerify);
@@ -442,12 +442,12 @@ std::string CReporterBugzilla::Report(const map_crash_report_t& pCrashReport,
update_client(_("Checking for duplicates..."));
bug_id = bz_server.check_uuid_in_bugzilla(component.c_str(), uuid.c_str());
- update_client(_("Logging into bugzilla..."));
if ((Login == "") && (Password == ""))
{
VERB3 log("Empty login and password");
throw CABRTException(EXCEP_PLUGIN, _("Empty login and password. Please check Bugzilla.conf"));
}
+ update_client(_("Logging into bugzilla..."));
bz_server.login(Login.c_str(), Password.c_str());
if (bug_id > 0)
@@ -458,12 +458,14 @@ std::string CReporterBugzilla::Report(const map_crash_report_t& pCrashReport,
bz_server.add_plus_one_cc(bug_id, Login.c_str());
}
bz_server.logout();
- return BugzillaURL + "/show_bug.cgi?id=" + to_string(bug_id);
+ BugzillaURL += "/show_bug.cgi?id=";
+ BugzillaURL += to_string(bug_id);
+ return BugzillaURL;
}
update_client(_("Creating new bug..."));
- bug_id = bz_server.new_bug(pCrashReport);
- bz_server.add_attachments(to_string(bug_id).c_str(), pCrashReport);
+ bug_id = bz_server.new_bug(pCrashData);
+ bz_server.add_attachments(to_string(bug_id).c_str(), pCrashData);
update_client(_("Logging out..."));
bz_server.logout();
@@ -475,12 +477,16 @@ std::string CReporterBugzilla::Report(const map_crash_report_t& pCrashReport,
if (bug_id > 0)
{
- return BugzillaURL + "/show_bug.cgi?id=" + to_string(bug_id);
+ BugzillaURL += "/show_bug.cgi?id=";
+ BugzillaURL += to_string(bug_id);
+ return BugzillaURL;
}
- return BugzillaURL + "/show_bug.cgi?id=";
+ BugzillaURL += "/show_bug.cgi?id=";
+ return BugzillaURL;
}
+//todo: make static
map_plugin_settings_t CReporterBugzilla::parse_settings(const map_plugin_settings_t& pSettings)
{
map_plugin_settings_t plugin_settings;