diff --git a/src/com/fsck/k9/helper/configxmlparser/AutoconfigInfo.java b/src/com/fsck/k9/helper/configxmlparser/AutoconfigInfo.java index 51a634a26..b6e732495 100644 --- a/src/com/fsck/k9/helper/configxmlparser/AutoconfigInfo.java +++ b/src/com/fsck/k9/helper/configxmlparser/AutoconfigInfo.java @@ -13,6 +13,8 @@ import java.util.List; import android.os.Parcel; import android.os.Parcelable; import android.util.Pair; +import com.fsck.k9.K9; +import org.w3c.dom.Text; /* NOTE: We assume here there is one emailprovider in a file with the data version information in a one-on-one relation @@ -349,8 +351,8 @@ public class AutoconfigInfo implements Parcelable { public String displayShortName; // Possible servers for this ISP - public List incomingServer; - public List outgoingServer; + public List incomingServer; + public List outgoingServer; // Configuration help/information public String identity; @@ -365,8 +367,8 @@ public class AutoconfigInfo implements Parcelable { */ public AutoconfigInfo(){ // initialise the fields - incomingServer = new ArrayList(); - outgoingServer = new ArrayList(); + incomingServer = new ArrayList(); + outgoingServer = new ArrayList(); domains = new ArrayList(); inputFields = new ArrayList(); } @@ -380,6 +382,14 @@ public class AutoconfigInfo implements Parcelable { displayName = parcel.readString(); displayShortName = parcel.readString(); + incomingServer = parcel.readArrayList(IncomingServer.class.getClassLoader()); + outgoingServer = parcel.readArrayList(OutgoingServer.class.getClassLoader()); + + identity = parcel.readString(); + inputFields = parcel.readArrayList(InputField.class.getClassLoader()); + enable = (InformationBlock) parcel.readValue(InformationBlock.class.getClassLoader()); + instruction = (InformationBlock) parcel.readValue(InformationBlock.class.getClassLoader()); + documentation = (InformationBlock) parcel.readValue(InformationBlock.class.getClassLoader()); } @@ -407,20 +417,21 @@ public class AutoconfigInfo implements Parcelable { } // filters the list of servers according to the arguments ( list of allowed specifications ) - private List getFilteredServerList - (List serverList, List serverTypes, List authenticationTypes, List socketTypes){ - ArrayList servers = new ArrayList(); - ArrayList toBeRemoved = new ArrayList(); + private List getFilteredServerList + (List serverList, List serverTypes, List authenticationTypes, List socketTypes) + { + ArrayList servers = new ArrayList(); + ArrayList toBeRemoved = new ArrayList(); // filter for servertypes if( serverTypes != null && !serverTypes.isEmpty() ) - for( Server serv : serverList ) + for( T serv : serverList ) if( serverTypes.contains(serv.type)) servers.add(serv); // filter for autenticationtype if( authenticationTypes != null & !authenticationTypes.isEmpty() ){ - for( Server serv : servers ) + for( T serv : servers ) if( !authenticationTypes.contains(serv.authentication) ) toBeRemoved.add(serv); } @@ -429,7 +440,7 @@ public class AutoconfigInfo implements Parcelable { // filter for sockettype if( socketTypes != null & !socketTypes.isEmpty() ) - for( Server serv : servers ) + for( T serv : servers ) if( !socketTypes.contains(serv.socketType) ) toBeRemoved.add(serv); servers.removeAll(toBeRemoved); @@ -438,12 +449,12 @@ public class AutoconfigInfo implements Parcelable { } // public wrappers for the filter method - public List getOutgoingServers + public List getOutgoingServers (List serverTypes, List authenticationTypes, List socketTypes){ return getFilteredServerList(outgoingServer, serverTypes, authenticationTypes, socketTypes); } - public List getIncomingServers + public List getIncomingServers (List serverTypes, List authenticationTypes, List socketTypes){ return getFilteredServerList(incomingServer, serverTypes, authenticationTypes, socketTypes); } diff --git a/src/com/fsck/k9/helper/configxmlparser/ConfigurationXMLHandler.java b/src/com/fsck/k9/helper/configxmlparser/ConfigurationXMLHandler.java index 7016d4c5c..c1fd9dd7e 100644 --- a/src/com/fsck/k9/helper/configxmlparser/ConfigurationXMLHandler.java +++ b/src/com/fsck/k9/helper/configxmlparser/ConfigurationXMLHandler.java @@ -48,6 +48,8 @@ import com.fsck.k9.helper.configxmlparser.AutoconfigInfo.IncomingServerPOP3; import com.fsck.k9.helper.configxmlparser.AutoconfigInfo.OutgoingServerSMTP; import com.fsck.k9.helper.configxmlparser.AutoconfigInfo.InputField; import com.fsck.k9.helper.configxmlparser.AutoconfigInfo.InformationBlock; +import com.fsck.k9.helper.configxmlparser.AutoconfigInfo.IncomingServer; +import com.fsck.k9.helper.configxmlparser.AutoconfigInfo.OutgoingServer; // Other import java.util.HashMap; @@ -288,7 +290,10 @@ public class ConfigurationXMLHandler extends DefaultHandler { String type = attributes.getValue(ATTRIBUTE.TYPE.getXMLStringVersion()); if( type != null ){ mServerInProgress = ServerType.toType(type).getServerObject(null); - mAutoconfigInfo.incomingServer.add(mServerInProgress); + if( TAG.toTag(localName) == TAG.INCOMINGSERVER ) + mAutoconfigInfo.incomingServer.add((IncomingServer)mServerInProgress); + else if( TAG.toTag(localName) == TAG.OUTGOINGSERVER ) + mAutoconfigInfo.outgoingServer.add((OutgoingServer)mServerInProgress); }else{ // this should never happen, this file is not formed correctly ( check the relaxng scheme ) throw new SAXParseException("Incoming|Outgoing-Server tag has no type attribute!", mLocator); }break;