From a49dcef3b2e386179115605fd4b37f7f4ce02fb5 Mon Sep 17 00:00:00 2001 From: Matěj Cepl Date: Thu, 4 Aug 2011 01:23:31 +0200 Subject: Just reformatting and more debug logging. --- lib/libbugzilla.js | 30 ++++++++++++++++-------------- lib/main.js | 1 + 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/lib/libbugzilla.js b/lib/libbugzilla.js index 2dc1dc5..145332a 100644 --- a/lib/libbugzilla.js +++ b/lib/libbugzilla.js @@ -124,7 +124,6 @@ function getPassword(login, domain, callback) { else { // We don't have password, and user haven't entered one? // Does he want to live passwordless? - // FIXME should we call the callback at all? var switchOff = prompts.promptYesNoCancel(switchPrompt); if (switchOff) { preferences.set(prefName,true); @@ -137,6 +136,7 @@ function getPassword(login, domain, callback) { }); } +// Change URL of the configuration JSON file exports.changeJSONURL = function changeJSONURL() { var prfNm = BTSPrefNS+"JSONURL"; var url = preferences.get(prfNm, JSONURLDefault); @@ -329,24 +329,26 @@ exports.makeXMLRPCCall = function makeXMLRPCCall(url, login, method, params, cal ); }; -exports.makeJSONRPCCallWithLogin = function makeJSONRPCCallWithLogin(url, method, params, - login, callback) { +exports.makeJSONRPCCallWithLogin = function makeJSONRPCCallWithLogin(url, method, + params, login, callback) { var urlObj = urlMod.URL(url); getPassword(login, urlObj.scheme + "://" + urlObj.host, function (passObj) { - if (!passObj.password) { - return; - } + if (!passObj.password) { + return; + } - makeJSONRPCCall(url, "User.login", { - login: login, - password: passObj.password, - remember: false - }, function(logResult) { - makeJSONRPCCall(url, method, params, callback); - }); - } + console.myDebug("makeJSONRPCCallWithLogin: passObj = " + + passObj.toSource()); + makeJSONRPCCall(url, "User.login", { + login: login, + password: passObj.password, + remember: false + }, function(logResult) { + makeJSONRPCCall(url, method, params, callback); + }); + } ); }; diff --git a/lib/main.js b/lib/main.js index 4db620a..9c42166 100644 --- a/lib/main.js +++ b/lib/main.js @@ -94,6 +94,7 @@ var messageHandler = exports.messageHandler = function messageHandler( break; case "MakeJSONRPCall": // url, login, method, params, callback + console.myDebug("messageHandler: msg = " + msg.toSource()); if (msg.data.login) { libbz .makeJSONRPCCallWithLogin(msg.data.url, -- cgit