コード例 #1
0
  private void handleServerFolderChange(Folder folder) throws AuthenticationFailedException {
    long accountId = folder.accountId;
    List<Message> m = new ArrayList<Message>();
    List<String> remoteSIds = new ArrayList<String>();
    List<String> localSids =
        Note.getAllSyncedNoteSidByFolderId(folder.id, accountId, application.getDBHelper());
    try {
      Message[] messages = imapStoreClient.getMessages(folder.name);
      for (Message msg : messages) {
        remoteSIds.add(msg.getUid());
        if (!localSids.contains(msg.getUid())) m.add(msg);
      }
      if (m.size() > 0) {
        fetMessages(m, folder);
      }
    } catch (AuthenticationFailedException e) {
      Log.e(TAG, "", e);
      throw new AuthenticationFailedException(e.getLocalizedMessage());
    } catch (MessagingException e) {
      Log.e(TAG, "", e);
      throw new AuthenticationFailedException(e.getLocalizedMessage());
    }

    handleRemoteDeletedNotes(accountId, folder.id, remoteSIds);
  }
コード例 #2
0
 @Override
 public void instance(INotesApplication application) {
   super.instance(application);
   imapStoreClient = new ImapStoreClient();
   try {
     if (!application.getAccountManager().isLocalMode()) {
       imapStoreClient.init(application.getAccountManager().getAccount(), application);
       loginUser = application.getAccountManager().getEmail();
     }
   } catch (AuthenticationFailedException e) {
     Log.e(TAG, "", e);
     throw new AuthenticationErrorException(e.getLocalizedMessage());
   }
 }