status("Logging in to " + g.toString());
status(StatusUpdate.LEVEL_GENERIC, "Logging in to " + g.toString());
		private boolean login() {			status("Logging in to " + g.toString());						try	{				URL url = g.getGalleryUrl(SCRIPT_NAME);				String urlPath = url.getFile();				Log.log(Log.TRACE, MODULE, "Url: " + url);								NVPair form_data[] = {					new NVPair("cmd", "login"),					new NVPair("protocal_version", PROTOCAL_VERSION),					new NVPair("uname", g.getUsername()),					new NVPair("password", g.getPassword())				};				Log.log(Log.TRACE, MODULE, "login parameters: " + Arrays.asList(form_data));								HTTPConnection mConnection = new HTTPConnection(url);				HTTPResponse rsp = mConnection.Post(urlPath, form_data);								if (rsp.getStatusCode() >= 300 && rsp.getStatusCode() < 400) {					// retry, the library will have fixed the URL					status("Received redirect, following...");										rsp = mConnection.Post(urlPath, form_data);				}								if (rsp.getStatusCode() >= 300)	{					error("HTTP Error: "+ rsp.getStatusCode()+" "+rsp.getReasonLine());					return false;				} else {					String response = new String(rsp.getData()).trim();					Log.log(Log.TRACE, MODULE, response);										if (response.indexOf("SUCCESS") >= 0) {						status("Logged in");						return true;					} else {						error("Login Error: " + response);						return false;					}				}			} catch (IOException ioe) {				Log.logException(Log.ERROR, MODULE, ioe);				status("Error: " + ioe.toString());			} catch (ModuleException me) {				Log.logException(Log.ERROR, MODULE, me);				status("Error handling request: " + me.getMessage());			}				return false;		}