public GoogleVoiceFolder connect( Account account, String context, StopWatch watch, GoogleVoiceProcess process) throws IOException, MessagingException { StopWatchUtils.newTask(watch, "Get session", context, log); Session session = Session.getInstance(getMailProperties(account)); StopWatchUtils.newTask(watch, "Get store", context, log); Store store = session.getStore("pop3"); GoogleVoiceFolder inbox = new GoogleVoiceFolder(session, process.getVoice()); StopWatchUtils.newTask(watch, "Open folder", context, log); inbox.open(Folder.READ_ONLY); return inbox; }
protected Message getFullyLoad(Message message, Folder folder, String context) throws MessagingException { try { ((GoogleVoiceFolder) folder).loadFully((GoogleVoiceMessage) message); } catch (Exception e) { throw new MessagingException("Exception getting googlevoice message body " + e.getMessage()); } Message wrappedMessage = new MimeMessage((MimeMessage) message); wrappedMessage.setSentDate(message.getSentDate()); return wrappedMessage; }