summaryrefslogtreecommitdiffstats
path: root/lib/Plugins/Bugzilla.h
blob: 7280f4f0b6a5f5cf4568f3fd0678bec78c79d2d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#ifndef BUGZILLA_H_
#define BUGZILLA_H_

#include "Plugin.h"
#include "Reporter.h"
#include <xmlrpc-c/client.hpp>

#include <nssb64.h>

#define XML_RPC_SUFFIX "/xmlrpc.cgi"

class CReporterBugzilla : public CReporter
{
    private:
        typedef std::map<std::string, xmlrpc_c::value> map_xmlrpc_params_t;

        void NewXMLRPCClient();
        void DeleteXMLRPCClient();
        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);
        std::string 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);
        void CreateNewBugDescription(const map_crash_report_t& pCrashReport,
                                     std::string& pDescription);
        void GetProductAndVersion(const std::string& pRelease,
                                  std::string& pProduct,
                                  std::string& pVersion);

        xmlrpc_c::clientXmlTransport_curl* m_pXmlrpcTransport;
        xmlrpc_c::client_xml* m_pXmlrpcClient;
        xmlrpc_c::carriageParm_curl0 *m_pCarriageParm;
        std::string m_sBugzillaURL;
        std::string m_sBugzillaXMLRPC;
        std::string m_sLogin;
        std::string m_sPassword;
        std::string m_sAttchmentInBase64;
        bool m_bNoSSLVerify;

    public:
        CReporterBugzilla();
        virtual ~CReporterBugzilla();
        virtual void SetSettings(const map_plugin_settings_t& pSettings);
        virtual map_plugin_settings_t GetSettings();
        virtual std::string Report(const map_crash_report_t& pCrashReport,
                                   const std::string& pArgs);
};

#endif /* BUGZILLA_H_ */