Ejemplo n.º 1
0
 private boolean hasUIDL() throws IOException {
   if (connection.hasCapability(Pop3Capabilities.UIDL)) {
     return true;
   }
   // Additional check for servers that don't support CAPA
   // (i.e. Hotmail) but do support UIDL.
   try {
     if (connection.getMessageCount() > 0) {
       // Only need to test UIDL on first message
       connection.getMessageUid(1);
     } else {
       connection.getMessageUids();
     }
   } catch (CommandFailedException e) {
     return false;
   }
   return true;
 }
Ejemplo n.º 2
0
 @Override
 public synchronized void importData(List<Integer> folderIds, boolean fullSync)
     throws ServiceException {
   validateDataSource();
   connect();
   try {
     if (connection.getMessageCount() > 0) {
       if (dataSource.leaveOnServer()) {
         fetchAndRetainMessages();
       } else {
         fetchAndDeleteMessages();
       }
     }
     connection.quit();
   } catch (ServiceException e) {
     throw e;
   } catch (Exception e) {
     throw ServiceException.FAILURE("Synchronization of POP3 folder failed", e);
   } finally {
     connection.close();
   }
 }