requestResponse(null, null, g.getLoginUrl(scriptName), false, su);
requestResponse(null, null, g.getLoginUrl(scriptName), false, su, this);
		private boolean login() {			Object[] params = {g.toString()};			status(su, StatusUpdate.LEVEL_GENERIC, GRI18n.getString(MODULE, "logIn", params));			if (g.getType() != Gallery.TYPE_STANDALONE && g.getType() != Gallery.TYPE_APPLET) {				try {					requestResponse(null, null, g.getLoginUrl(scriptName), false, su);				} catch (IOException ioe) {					Log.logException(Log.LEVEL_ERROR, MODULE, ioe);					Object[] params2 = {ioe.toString()};					error(su, GRI18n.getString(MODULE, "error", params2));				} catch (ModuleException me) {					Log.logException(Log.LEVEL_ERROR, MODULE, me);					Object[] params2 = {me.getMessage()};					error(su, GRI18n.getString(MODULE, "errReq", params2));				}			}			// setup protocol parameters			String username = g.getUsername();			String password = g.getPassword();			if ((username == null || username.length() == 0)					&& ! g.cookieLogin) {				username = (String) JOptionPane.showInputDialog(						GalleryRemote._().getMainFrame(),						GRI18n.getString(MODULE, "usernameLbl"),						GRI18n.getString(MODULE, "username"),						JOptionPane.PLAIN_MESSAGE,						null,						null,						null);				if (username != null) {					g.setUsername(username);				}			}			if (username != null && (password == null || password.length() == 0)) {				password = (String) JOptionPane.showInputDialog(						GalleryRemote._().getMainFrame(),						GRI18n.getString(MODULE, "passwdLbl"),						GRI18n.getString(MODULE, "passwd"),						JOptionPane.PLAIN_MESSAGE,						null,						null,						null);				g.setPassword(password);			}			NVPair form_data[] = {				new NVPair("cmd", "login"),				new NVPair("protocol_version", PROTOCOL_VERSION),				null,				null			};			if (username != null) {				form_data[2] = new NVPair("uname", username);				Log.log(Log.LEVEL_TRACE, MODULE, "login parameters: " + Arrays.asList(form_data));				form_data[3] = new NVPair("password", password);			} else {				Log.log(Log.LEVEL_TRACE, MODULE, "login parameters: " + Arrays.asList(form_data));			}			form_data = fudgeFormParameters(form_data);			// make the request			try {				triedLogin = true;				// load and validate the response				Properties p = requestResponse(form_data, g.getGalleryUrl(scriptName), su);				if (GR_STAT_SUCCESS.equals(p.getProperty("status"))						|| GR_STAT_LOGIN_MISSING.equals(p.getProperty("status"))) {					status(su, StatusUpdate.LEVEL_GENERIC, GRI18n.getString(MODULE, "loggedIn"));					try {						String serverVersion = p.getProperty("server_version");						int i = serverVersion.indexOf(".");						serverMinorVersion = Integer.parseInt(serverVersion.substring(i + 1));						Log.log(Log.LEVEL_TRACE, MODULE, "Server minor version: " + serverMinorVersion);						handleCapabilities();					} catch (Exception e) {						Log.log(Log.LEVEL_ERROR, MODULE, "Malformed server_version: " + p.getProperty("server_version"));						Log.logException(Log.LEVEL_ERROR, MODULE, e);					}					return true;				} else if (GR_STAT_PASSWD_WRONG.equals(p.getProperty("status"))) {					error(su, GRI18n.getString(MODULE, "usrpwdErr"));					return false;				} else {					Object[] params2 = {p.getProperty("status_text")};					error(su, GRI18n.getString(MODULE, "loginErr", params2));					return false;				}			} catch (GR2Exception gr2e) {				Log.logException(Log.LEVEL_ERROR, MODULE, gr2e);				Object[] params2 = {gr2e.getMessage()};				error(su, GRI18n.getString(MODULE, "error", params2));			} catch (IOException ioe) {				Log.logException(Log.LEVEL_ERROR, MODULE, ioe);				Object[] params2 = {ioe.toString()};				error(su, GRI18n.getString(MODULE, "error", params2));			} catch (ModuleException me) {				Log.logException(Log.LEVEL_ERROR, MODULE, me);				Object[] params2 = {me.getMessage()};				error(su, GRI18n.getString(MODULE, "errReq", params2));			}			return false;		}