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 // parse and finish
// remember if i >= UNSAFE_URL_START => POSSIBLE UNSAFE DATA, alert user!!! // remember if i >= UNSAFE_URL_START => POSSIBLE UNSAFE DATA, alert user!!!
parse(data); parse(data);
try {
Thread.sleep(1750); // Give user some time to read output
} catch (InterruptedException e) { try { Thread.sleep(1750);
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. } catch (InterruptedException e) { e.printStackTrace(); }
}
finish(); finish();
return; return;
} }

View File

@ -61,20 +61,24 @@ public class AutoconfigInfo {
Server types hierarchy Server types hierarchy
*******************************************************************************/ *******************************************************************************/
public static abstract class Server{ public static abstract class Server{
public ServerType type = ServerType.UNSET; public ServerType type;
public String hostname; public String hostname;
public int port; public int port;
public SocketType socketType; public SocketType socketType;
public String username; public String username;
public AuthenticationType authentication; public AuthenticationType authentication;
public Server(ServerType type){ this.type = type; }
} }
public static abstract class IncomingServer extends Server{ public static abstract class IncomingServer extends Server{
} public IncomingServer(ServerType type) {super(type);}
}
public static abstract class OutgoingServer extends Server{ public static abstract class OutgoingServer extends Server{
public RestrictionType restriction; public RestrictionType restriction;
} public OutgoingServer(ServerType type) {super(type);}
}
public static class IncomingServerPOP3 extends IncomingServer { public static class IncomingServerPOP3 extends IncomingServer {
// hardcode the type // hardcode the type
@ -85,10 +89,16 @@ public class AutoconfigInfo {
public boolean downloadOnBiff; public boolean downloadOnBiff;
public int daysToLeaveMessagesOnServer; public int daysToLeaveMessagesOnServer;
public int checkInterval; public int checkInterval;
// constructor
public IncomingServerPOP3(){ super(ServerType.POP3); }
} }
public static class IncomingServerIMAP extends IncomingServer { public static class IncomingServerIMAP extends IncomingServer {
public ServerType type = ServerType.IMAP; public ServerType type = ServerType.IMAP;
// constructor
public IncomingServerIMAP(){ super(ServerType.IMAP); }
} }
public static class OutgoingServerSMTP extends OutgoingServer { public static class OutgoingServerSMTP extends OutgoingServer {
@ -98,6 +108,9 @@ public class AutoconfigInfo {
// SMTP options // SMTP options
public boolean addThisServer; public boolean addThisServer;
public boolean useGlobalPreferredServer; 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, POP3, LEAVEMESSAGESONSERVER, DOWNLOADONBIFF, DAYSTOLEAVEMESSAGESONSERVER, CHECKINTERVAL,
// outgoing server settings // outgoing server settings
RESTRICTION, ADDTHISSERVER, USEGLOBALPREFFEREDSERVER, RESTRICTION, ADDTHISSERVER, USEGLOBALPREFERREDSERVER,
// meta // meta
NO_VALUE, WRONG_TAG; NO_VALUE, WRONG_TAG;
@ -325,7 +325,7 @@ public class ConfigurationXMLHandler extends DefaultHandler {
// Outgoing extras // Outgoing extras
case RESTRICTION: case RESTRICTION:
case ADDTHISSERVER: case ADDTHISSERVER:
case USEGLOBALPREFFEREDSERVER: case USEGLOBALPREFERREDSERVER:
if( mServerInProgress == null || mServerInProgress.type != ServerType.SMTP ) if( mServerInProgress == null || mServerInProgress.type != ServerType.SMTP )
throw new SAXParseException throw new SAXParseException
("Illegal outgoingServer extra-settings tag. " + ("Illegal outgoingServer extra-settings tag. " +
@ -333,7 +333,7 @@ public class ConfigurationXMLHandler extends DefaultHandler {
switch(TAG.toTag(localName)){ switch(TAG.toTag(localName)){
case RESTRICTION: mIsRestriction = true; break; case RESTRICTION: mIsRestriction = true; break;
case ADDTHISSERVER: mIsAddThisServer = true; break; case ADDTHISSERVER: mIsAddThisServer = true; break;
case USEGLOBALPREFFEREDSERVER: mIsUseGlobalPreferredServer = true; break; case USEGLOBALPREFERREDSERVER: mIsUseGlobalPreferredServer = true; break;
} }
break; break;