aboutsummaryrefslogtreecommitdiffstats
path: root/lib/libbugzilla.js
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@redhat.com>2011-09-01 10:29:28 +0200
committerMatěj Cepl <mcepl@redhat.com>2011-09-01 10:53:51 +0200
commit5efc52cf5cec2b9b5f75351da8e473c2f90266b5 (patch)
tree4bb5bbc15dde0607737e642c0a5075875ebf58bb /lib/libbugzilla.js
parentb6b75faa9ef841396731398a2882e869df5b8ae7 (diff)
downloadbugzilla-triage-5efc52cf5cec2b9b5f75351da8e473c2f90266b5.tar.gz
Eliminating MakeJSONRPC calls and fixing multiple logins.
Fixes #113.
Diffstat (limited to 'lib/libbugzilla.js')
-rw-r--r--lib/libbugzilla.js47
1 files changed, 6 insertions, 41 deletions
diff --git a/lib/libbugzilla.js b/lib/libbugzilla.js
index 46356cc..4858a96 100644
--- a/lib/libbugzilla.js
+++ b/lib/libbugzilla.js
@@ -11,7 +11,6 @@ var passUtils = require("passwords");
var Request = require("request").Request;
var selfMod = require("self");
var urlMod = require("url");
-var xrpc = require("xmlrpc");
var panelMod = require("panel");
var JSONURLDefault = "https://fedorahosted.org/released"+
@@ -87,8 +86,10 @@ function getRealBugNoSlow(bugNo, location, callback) {
}
function getPassword(login, domain, callback) {
- var passPrompt = "Enter your Bugzilla password for fixing MIME attachment types";
- var switchPrompt = "Do you want to switch off features requiring password completely";
+ var passPrompt = "Enter your Bugzilla password " +
+ "for accessing JSONRPC services";
+ var switchPrompt = "Do you want to switch off features " +
+ "requiring password completely";
var prefName = BTSPrefNS+"withoutPassowrd";
var retObject = {
password: null, // password string or null if no password provided
@@ -217,6 +218,7 @@ exports.getInstalledPackages = function getInstalledPackages(locationLoginObj, c
// In order to avoid sending whole password to the content script,
// we are sending just these two Booleans.
config.constantData.passwordState = {
+ password: passwObj.password,
passAvailable: (passwObj.password !== null),
withoutPass: passwObj.withoutPass
};
@@ -283,41 +285,6 @@ exports.createUpstreamBug = function createUpstreamBug(urlStr, subjectStr, comme
});
};
-// Make a XML-RPC call ... most of the business logic should stay in the content
-// script
-exports.makeXMLRPCCall = function makeXMLRPCCall(url, login, method, params, callback) {
- var urlObj = urlMod.URL(url);
- getPassword(login,
- urlObj.scheme + "://" + urlObj.host,
- function (passwObj) {
- if (!passwObj.password) {
- // TODO this should happen, only when user presses Escape in password
- // prompt
- return null;
- }
-
- var msg = new xrpc.XMLRPCMessage(method);
- params.forEach(function (par) {
- msg.addParameter(par);
- });
- msg.addParameter(login);
- msg.addParameter(passwObj.password);
-
- Request({
- url: url,
- onComplete: function(response) {
- if (response.status == 200) {
- var resp = parseXMLfromString(response.text);
- callback(resp.toXMLString());
- }
- },
- content: msg.xml(),
- contentType: "text/xml"
- }).post();
- }
- );
-};
-
exports.makeJSONRPCCallWithLogin = function makeJSONRPCCallWithLogin(url, method,
params, login, callback) {
var urlObj = urlMod.URL(url);
@@ -328,7 +295,7 @@ exports.makeJSONRPCCallWithLogin = function makeJSONRPCCallWithLogin(url, method
return;
}
- console.myDebug("makeJSONRPCCallWithLogin: passObj = " +
+ debug("makeJSONRPCCallWithLogin: passObj = " +
passObj.toSource());
makeJSONRPCCall(url, "User.login", {
login: login,
@@ -418,8 +385,6 @@ exports.initialize = function initialize(config, callback) {
config.constantData = config.gJSONData.constantData;
config.constantData.queryUpstreamBug = JSON.parse(
selfMod.data.load("queryUpstreamBug.json"));
- config.constantData.XMLRPCData = JSON.parse(
- selfMod.data.load("XMLRPCdata.json"));
config.constantData.bugzillaLabelNames =
JSON.parse(selfMod.data.load("bugzillalabelNames.json"));
config.constantData.newUpstreamBug =