1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-08-13 17:03:48 -04:00

Fixed some faults in the parser. Changed the Server classes hierarchy a bit.

This commit is contained in:
Sander Bogaert 2011-07-08 16:17:58 +02:00 committed by Andrew Chen
parent f2fa32c3db
commit 9af0d55676
3 changed files with 24 additions and 11 deletions

View File

@ -153,11 +153,11 @@ public class AccountSetupAutoConfiguration extends K9Activity implements View.On
// parse and finish
// remember if i >= UNSAFE_URL_START => POSSIBLE UNSAFE DATA, alert user!!!
parse(data);
try {
Thread.sleep(1750);
} catch (InterruptedException e) {
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
}
// Give user some time to read output
try { Thread.sleep(1750);
} catch (InterruptedException e) { e.printStackTrace(); }
finish();
return;
}

View File

@ -61,20 +61,24 @@ public class AutoconfigInfo {
Server types hierarchy
*******************************************************************************/
public static abstract class Server{
public ServerType type = ServerType.UNSET;
public ServerType type;
public String hostname;
public int port;
public SocketType socketType;
public String username;
public AuthenticationType authentication;
public Server(ServerType type){ this.type = type; }
}
public static abstract class IncomingServer extends Server{
}
public IncomingServer(ServerType type) {super(type);}
}
public static abstract class OutgoingServer extends Server{
public RestrictionType restriction;
}
public OutgoingServer(ServerType type) {super(type);}
}
public static class IncomingServerPOP3 extends IncomingServer {
// hardcode the type
@ -85,10 +89,16 @@ public class AutoconfigInfo {
public boolean downloadOnBiff;
public int daysToLeaveMessagesOnServer;
public int checkInterval;
// constructor
public IncomingServerPOP3(){ super(ServerType.POP3); }
}
public static class IncomingServerIMAP extends IncomingServer {
public ServerType type = ServerType.IMAP;
// constructor
public IncomingServerIMAP(){ super(ServerType.IMAP); }
}
public static class OutgoingServerSMTP extends OutgoingServer {
@ -98,6 +108,9 @@ public class AutoconfigInfo {
// SMTP options
public boolean addThisServer;
public boolean useGlobalPreferredServer;
// constructor
public OutgoingServerSMTP(){ super(ServerType.SMTP); }
}

View File

@ -79,7 +79,7 @@ public class ConfigurationXMLHandler extends DefaultHandler {
POP3, LEAVEMESSAGESONSERVER, DOWNLOADONBIFF, DAYSTOLEAVEMESSAGESONSERVER, CHECKINTERVAL,
// outgoing server settings
RESTRICTION, ADDTHISSERVER, USEGLOBALPREFFEREDSERVER,
RESTRICTION, ADDTHISSERVER, USEGLOBALPREFERREDSERVER,
// meta
NO_VALUE, WRONG_TAG;
@ -325,7 +325,7 @@ public class ConfigurationXMLHandler extends DefaultHandler {
// Outgoing extras
case RESTRICTION:
case ADDTHISSERVER:
case USEGLOBALPREFFEREDSERVER:
case USEGLOBALPREFERREDSERVER:
if( mServerInProgress == null || mServerInProgress.type != ServerType.SMTP )
throw new SAXParseException
("Illegal outgoingServer extra-settings tag. " +
@ -333,7 +333,7 @@ public class ConfigurationXMLHandler extends DefaultHandler {
switch(TAG.toTag(localName)){
case RESTRICTION: mIsRestriction = true; break;
case ADDTHISSERVER: mIsAddThisServer = true; break;
case USEGLOBALPREFFEREDSERVER: mIsUseGlobalPreferredServer = true; break;
case USEGLOBALPREFERREDSERVER: mIsUseGlobalPreferredServer = true; break;
}
break;