summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZdenek Prikryl <zdeny@dhcp-lab-218.englab.brq.redhat.com>2009-08-11 18:37:02 +0200
committerZdenek Prikryl <zdeny@dhcp-lab-218.englab.brq.redhat.com>2009-08-11 18:37:02 +0200
commitc0a64f7f5ed5abc1f729177da84d496a49e10081 (patch)
treed93f30201095ab8eba7b1b9f8e7b7bf974194d5c
parent2e51143de7ebdf71a19818ea613e3c37c1132c39 (diff)
downloadabrt-c0a64f7f5ed5abc1f729177da84d496a49e10081.tar.gz
abrt-c0a64f7f5ed5abc1f729177da84d496a49e10081.tar.xz
abrt-c0a64f7f5ed5abc1f729177da84d496a49e10081.zip
bugzilla plugin can do +1 in a bugzilla
-rw-r--r--lib/Plugins/Bugzilla.cpp70
-rw-r--r--lib/Plugins/Bugzilla.h3
2 files changed, 62 insertions, 11 deletions
diff --git a/lib/Plugins/Bugzilla.cpp b/lib/Plugins/Bugzilla.cpp
index 6bbb75c6..8a901e39 100644
--- a/lib/Plugins/Bugzilla.cpp
+++ b/lib/Plugins/Bugzilla.cpp
@@ -94,6 +94,55 @@ void CReporterBugzilla::Logout()
}
}
+void CReporterBugzilla::AddPlusOneComment(const std::string& pBugId)
+{
+ xmlrpc_c::paramList paramList;
+ map_xmlrpc_params_t addCommentParams;
+ map_xmlrpc_params_t ret;
+
+ addCommentParams["id"] = xmlrpc_c::value_int(atoi(pBugId.c_str()));
+ addCommentParams["comment"] = xmlrpc_c::value_string("+1");
+
+ paramList.add(xmlrpc_c::value_struct(addCommentParams));
+ xmlrpc_c::rpcPtr rpc(new xmlrpc_c::rpc("Bug.add_comment", paramList));
+ try
+ {
+ rpc->call(m_pXmlrpcClient, m_pCarriageParm);
+ }
+ catch (std::exception& e)
+ {
+ throw CABRTException(EXCEP_PLUGIN, std::string("CReporterBugzilla::AddPlusOneComment(): ") + e.what());
+ }
+ ret = xmlrpc_c::value_struct(rpc->getResult());
+}
+
+void CReporterBugzilla::AddPlusOneCC(const std::string& pBugId)
+{
+ xmlrpc_c::paramList paramList;
+ map_xmlrpc_params_t addCCParams;
+ map_xmlrpc_params_t ret;
+ map_xmlrpc_params_t updates;
+
+ std::vector<xmlrpc_c::value> CCList;
+ CCList.push_back(xmlrpc_c::value_string(m_sLogin));
+ updates["add_cc"] = xmlrpc_c::value_array(CCList);
+
+ addCCParams["ids"] = xmlrpc_c::value_int(atoi(pBugId.c_str()));
+ addCCParams["updates"] = xmlrpc_c::value_struct(updates);
+
+ paramList.add(xmlrpc_c::value_struct(addCCParams));
+ xmlrpc_c::rpcPtr rpc(new xmlrpc_c::rpc("Bug.update", paramList));
+ try
+ {
+ rpc->call(m_pXmlrpcClient, m_pCarriageParm);
+ }
+ catch (std::exception& e)
+ {
+ throw CABRTException(EXCEP_PLUGIN, std::string("CReporterBugzilla::AddPlusOneComment(): ") + e.what());
+ }
+ ret = xmlrpc_c::value_struct(rpc->getResult());
+}
+
bool CReporterBugzilla::CheckUUIDInBugzilla(const std::string& pComponent, const std::string& pUUID)
{
xmlrpc_c::paramList paramList;
@@ -115,8 +164,17 @@ bool CReporterBugzilla::CheckUUIDInBugzilla(const std::string& pComponent, const
std::vector<xmlrpc_c::value> bugs = xmlrpc_c::value_array(ret["bugs"]).vectorValueValue();
if (bugs.size() > 0)
{
- comm_layer_inner_debug("Bug is already reported.");
- comm_layer_inner_status("Bug is already reported.");
+ map_xmlrpc_params_t bug;
+ std::stringstream ss;
+
+ bug = xmlrpc_c::value_struct(bugs[0]);
+ ss << xmlrpc_c::value_int(bug["bug_id"]);
+
+ comm_layer_inner_debug("Bug is already reported: " + ss.str());
+ comm_layer_inner_status("Bug is already reported: " + ss.str());
+
+ AddPlusOneComment(ss.str());
+ AddPlusOneCC(ss.str());
return true;
}
return false;
@@ -319,14 +377,6 @@ void CReporterBugzilla::Report(const map_crash_report_t& pCrashReport, const std
DeleteXMLRPCClient();
}
-void CReporterBugzilla::LoadSettings(const std::string& pPath)
-{
- map_plugin_settings_t settings;
- plugin_load_settings(pPath, settings);
-
- SetSettings(settings);
-}
-
void CReporterBugzilla::SetSettings(const map_plugin_settings_t& pSettings)
{
if (pSettings.find("BugzillaURL") != pSettings.end())
diff --git a/lib/Plugins/Bugzilla.h b/lib/Plugins/Bugzilla.h
index 84ae4e68..3849f17f 100644
--- a/lib/Plugins/Bugzilla.h
+++ b/lib/Plugins/Bugzilla.h
@@ -17,6 +17,8 @@ class CReporterBugzilla : public CReporter
static PRInt32 Base64Encode_cb(void *arg, const char *obuf, PRInt32 size);
void Login();
void Logout();
+ void AddPlusOneComment(const std::string& pBugId);
+ void AddPlusOneCC(const std::string& pBugId);
bool CheckUUIDInBugzilla(const std::string& pComponent, const std::string& pUUID);
std::string NewBug(const map_crash_report_t& pCrashReport);
void AddAttachments(const std::string& pBugId, const map_crash_report_t& pCrashReport);
@@ -38,7 +40,6 @@ class CReporterBugzilla : public CReporter
public:
CReporterBugzilla();
virtual ~CReporterBugzilla();
- virtual void LoadSettings(const std::string& pPath);
virtual void SetSettings(const map_plugin_settings_t& pSettings);
virtual map_plugin_settings_t GetSettings();
virtual void Report(const map_crash_report_t& pCrashReport,