Search in sources :

Example 1 with HotmailEmailSender

use of games.strategy.engine.pbem.HotmailEmailSender in project triplea by triplea-game.

the class PbemSetupPanel method loadEmailSender.

/**
 * Configures the list of Email senders. If the game was saved we use this email sender.
 * Since passwords are not stored in save games, the LocalBeanCache is checked
 *
 * @param data
 *        the game data
 */
private void loadEmailSender(final GameData data) {
    // The list of email, either loaded from cache or created
    final List<IEmailSender> emailSenders = new ArrayList<>();
    emailSenders.add(useCacheIfAvailable(new NullEmailSender()));
    emailSenders.add(useCacheIfAvailable(new GmailEmailSender()));
    emailSenders.add(useCacheIfAvailable(new HotmailEmailSender()));
    emailSenders.add(useCacheIfAvailable(new GenericEmailSender()));
    emailSenderEditor.setBeans(emailSenders);
    // now get the sender from the save game, update it with credentials from the cache, and set it
    final IEmailSender sender = (IEmailSender) data.getProperties().get(PBEMMessagePoster.EMAIL_SENDER_PROP_NAME);
    if (sender != null) {
        final IEmailSender cached = (IEmailSender) LocalBeanCache.INSTANCE.getSerializable(sender.getClass().getCanonicalName());
        if (cached != null) {
            sender.setUserName(cached.getUserName());
            sender.setPassword(cached.getPassword());
            sender.setCredentialsSaved(cached.areCredentialsSaved());
        }
        emailSenderEditor.setSelectedBean(sender);
    }
}
Also used : GmailEmailSender(games.strategy.engine.pbem.GmailEmailSender) NullEmailSender(games.strategy.engine.pbem.NullEmailSender) IEmailSender(games.strategy.engine.pbem.IEmailSender) ArrayList(java.util.ArrayList) HotmailEmailSender(games.strategy.engine.pbem.HotmailEmailSender) GenericEmailSender(games.strategy.engine.pbem.GenericEmailSender)

Aggregations

GenericEmailSender (games.strategy.engine.pbem.GenericEmailSender)1 GmailEmailSender (games.strategy.engine.pbem.GmailEmailSender)1 HotmailEmailSender (games.strategy.engine.pbem.HotmailEmailSender)1 IEmailSender (games.strategy.engine.pbem.IEmailSender)1 NullEmailSender (games.strategy.engine.pbem.NullEmailSender)1 ArrayList (java.util.ArrayList)1