/*
 * Copyright 2011 Miltiadis Allamanis
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
 
/**
 * 
 */
package ac.uk.cam.cl.passgroiApp;

import android.content.Context;
import android.content.SharedPreferences;

/**
 * A class for managing the configurations
 * 
 * @author Miltiadis Allamanis
 * 
 */
public class PassgoriConfigurations {
	/**
	 * Preferences name.
	 */
	public static final String PREFS_NAME = "PassgoriPrefs";

	/**
	 * The shared preferences object.
	 */
	private final SharedPreferences mSettings;

	/**
	 * Constructor for the configurations object.
	 * 
	 * @param context
	 *            the context to get preferences from
	 */
	public PassgoriConfigurations(Context context) {
		mSettings = context.getSharedPreferences(PREFS_NAME, 0);
	}

	/**
	 * 
	 * @return the stored port (default 80)
	 */
	public final int getPort() {
		return mSettings.getInt("passgoriPort", 80);
	}

	/**
	 * 
	 * @return the stored server, "" if none
	 */
	public final String getServer() {
		return mSettings.getString("passgoriServer", "nigori-dev.appspot.com");
	}

	/**
	 * 
	 * @return the stored server prefix (default nigori)
	 */
	public final String getServerPrefix() {
		return mSettings.getString("passgoriServerPrefix", "nigori");
	}

	/**
	 * 
	 * @return the stored username, "" if none
	 */
	public final String getUsername() {
		return mSettings.getString("passgoriUsername", "nobody");
	}

	/**
	 * Stores the port configuration.
	 * 
	 * @param port
	 *            the port
	 */
	public void setPort(final int port) {
		SharedPreferences.Editor editor = mSettings.edit();

		editor.putInt("passgoriPort", port);
		editor.commit();
	}

	/**
	 * Stores the server configuration.
	 * 
	 * @param server
	 *            the server
	 */
	public void setServer(final String server) {
		SharedPreferences.Editor editor = mSettings.edit();

		editor.putString("passgoriServer", server);
		editor.commit();
	}

	/**
	 * Stores the sever prefix configuration.
	 * 
	 * @param perfix
	 *            the prefix
	 */
	public void setServerPrefix(final String perfix) {
		SharedPreferences.Editor editor = mSettings.edit();

		editor.putString("passgoriServerPrefix", perfix);
		editor.commit();
	}

	/**
	 * Stores the username configuration.
	 * 
	 * @param username
	 *            the username
	 */
	public void setUsername(final String username) {
		SharedPreferences.Editor editor = mSettings.edit();

		editor.putString("passgoriUsername", username);
		editor.commit();
	}

}

@@ -1325,18 +1325,19 @@
 default 
-80
+443
 )%0A%09 */%0A%09
@@ -1411,10 +1411,11 @@
 t%22, 
-80
+443
 );%0A%09

Use SSL port