com.fsck.k9.mail.Address.getAddress()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(7.5k)|赞(0)|评价(0)|浏览(187)

本文整理了Java中com.fsck.k9.mail.Address.getAddress()方法的一些代码示例,展示了Address.getAddress()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Address.getAddress()方法的具体详情如下:
包路径:com.fsck.k9.mail.Address
类名称:Address
方法名:getAddress

Address.getAddress介绍

暂无

代码示例

代码示例来源:origin: k9mail/k-9

private void fillContactDataFromAddresses(Address[] addresses, List<Recipient> recipients,
    Map<String, Recipient> recipientMap) {
  for (Address address : addresses) {
    // TODO actually query contacts - not sure if this is possible in a single query tho :(
    Recipient recipient = new Recipient(address);
    recipients.add(recipient);
    recipientMap.put(address.getAddress(), recipient);
  }
}

代码示例来源:origin: k9mail/k-9

private String getSenderEmailAddress(Message message) {
  Address[] from = message.getFrom();
  if (from == null || from.length == 0) {
    return null;
  }
  return from[0].getAddress();
}

代码示例来源:origin: k9mail/k-9

private void removeRecipientsFromList(ArrayList<String> result, Message message, RecipientType recipientType) {
  for (Address address : message.getRecipients(recipientType)) {
    String addr = address.getAddress();
    if (addr != null) {
      result.remove(addr);
    }
  }
}

代码示例来源:origin: k9mail/k-9

public synchronized Identity findIdentity(Address addr) {
  for (Identity identity : identities) {
    String email = identity.getEmail();
    if (email != null && email.equalsIgnoreCase(addr.getAddress())) {
      return identity;
    }
  }
  return null;
}

代码示例来源:origin: k9mail/k-9

private String[] getCryptoRecipientsWithoutBcc() {
  ArrayList<String> recipientAddresses = new ArrayList<>(Arrays.asList(cryptoStatus.getRecipientAddresses()));
  Address[] bccAddresses = currentProcessedMimeMessage.getRecipients(RecipientType.BCC);
  for (Address bccAddress : bccAddresses) {
    recipientAddresses.remove(bccAddress.getAddress());
  }
  return recipientAddresses.toArray(new String[recipientAddresses.size()]);
}

代码示例来源:origin: k9mail/k-9

private static String getJisVariantFromFromHeaders(Message message) {
  Address addresses[] = message.getFrom();
  if (addresses == null || addresses.length == 0) {
    return null;
  }
  return getJisVariantFromAddress(addresses[0].getAddress());
}

代码示例来源:origin: k9mail/k-9

public String getDisplayNameOrAddress() {
  final String displayName = K9.showCorrespondentNames() ? getDisplayName() : null;
  if (displayName != null) {
    return displayName;
  }
  return address.getAddress();
}

代码示例来源:origin: k9mail/k-9

private void addAutocryptHeaderIfAvailable(long openPgpKeyId) {
  Address address = currentProcessedMimeMessage.getFrom()[0];
  byte[] keyData = autocryptOpenPgpApiInteractor.getKeyMaterialForKeyId(
      openPgpApi, openPgpKeyId, address.getAddress());
  if (keyData != null) {
    autocryptOperations.addAutocryptHeaderToMessage(currentProcessedMimeMessage, keyData,
        address.getAddress(), cryptoStatus.isSenderPreferEncryptMutual());
  }
}

代码示例来源:origin: k9mail/k-9

private void bindView(View view, Recipient recipient) {
  RecipientTokenHolder holder = (RecipientTokenHolder) view.getTag();
  holder.name.setText(highlightText(recipient.getDisplayNameOrUnknown(context)));
  String address = recipient.address.getAddress();
  holder.email.setText(highlightText(address));
  setContactPhotoOrPlaceholder(context, holder.photo, recipient);
  if (showAdvancedInfo) {
    bindCryptoAdvanced(recipient, holder);
  } else {
    bindCryptoSimple(recipient, holder);
  }
}

代码示例来源:origin: k9mail/k-9

@Test
public void testGetTo_multipleEmailAddress() {
  Uri uri = Uri.parse("mailto:test1@abc.com?to=test2@abc.com");
  MailTo mailToHelper = MailTo.parse(uri);
  Address[] emailAddressList = mailToHelper.getTo();
  assertEquals(emailAddressList[0].getAddress(), "test1@abc.com");
  assertEquals(emailAddressList[1].getAddress(), "test2@abc.com");
}

代码示例来源:origin: k9mail/k-9

@Test
public void testGetCc_multipleEmailAddress() {
  Uri uri = Uri.parse("mailto:test1@abc.com?cc=test3@abc.com,test4@abc.com");
  MailTo mailToHelper = MailTo.parse(uri);
  Address[] emailAddressList = mailToHelper.getCc();
  assertEquals(emailAddressList[0].getAddress(), "test3@abc.com");
  assertEquals(emailAddressList[1].getAddress(), "test4@abc.com");
}

代码示例来源:origin: k9mail/k-9

private void setupCryptoProviderStatus(Address address, String uidStatus, String autocryptStatus) {
  MatrixCursor cursorCryptoStatus = new MatrixCursor(PROJECTION_CRYPTO_STATUS);
  cursorCryptoStatus.addRow(new String[] { address.getAddress(), uidStatus, autocryptStatus });
  when(contentResolver
      .query(eq(Uri.parse("content://" + CRYPTO_PROVIDER + ".provider.exported/autocrypt_status")),
          aryEq(PROJECTION_CRYPTO_STATUS), nullable(String.class),
          aryEq(new String[] { address.getAddress() }),
          nullable(String.class))).thenReturn(cursorCryptoStatus);
}

代码示例来源:origin: k9mail/k-9

@Test
public void testGetTo_singleEmailAddress() {
  Uri uri = Uri.parse("mailto:test@abc.com");
  MailTo mailToHelper = MailTo.parse(uri);
  Address[] emailAddressList = mailToHelper.getTo();
  assertEquals(emailAddressList[0].getAddress(), "test@abc.com");
}

代码示例来源:origin: k9mail/k-9

@Test
public void testGetBcc_singleEmailAddress() {
  Uri uri = Uri.parse("mailto:?bcc=test3@abc.com");
  MailTo mailToHelper = MailTo.parse(uri);
  Address[] emailAddressList = mailToHelper.getBcc();
  assertEquals(emailAddressList[0].getAddress(), "test3@abc.com");
}

代码示例来源:origin: k9mail/k-9

@Test
public void queryContactProvider_sortByTimesContactedForNickname() throws Exception {
  RecipientLoader recipientLoader = new RecipientLoader(context, null, QUERYSTRING);
  setupContactProvider("%" + QUERYSTRING + "%", CONTACT_1);
  setupNicknameContactProvider(NICKNAME_NOT_CONTACTED);
  setupContactProviderForId(NICKNAME_NOT_CONTACTED[0], CONTACT_WITH_NICKNAME_NOT_CONTACTED);
  List<Recipient> recipients = recipientLoader.loadInBackground();
  assertEquals(2, recipients.size());
  assertEquals("bob@host.com", recipients.get(0).address.getAddress());
  assertEquals("eve_notContacted@host.com", recipients.get(1).address.getAddress());
}

代码示例来源:origin: k9mail/k-9

private void assertExtractedAddressMatchesEmail(String emailAddress, Address[] result) {
  assertNotNull(result);
  assertEquals(1, result.length);
  assertNotNull(result[0]);
  assertEquals(emailAddress, result[0].getAddress());
}

代码示例来源:origin: k9mail/k-9

@Test
public void getListPostAddresses_shouldProvideAllListPostHeaders() throws Exception {
  MimeMessage message = buildMimeMessageWithListPostValue(
      "<mailto:list1@example.org>", "<mailto:list2@example.org>");
  Address[] result = ListHeaders.getListPostAddresses(message);
  assertNotNull(result);
  assertEquals(2, result.length);
  assertNotNull(result[0]);
  assertEquals("list1@example.org", result[0].getAddress());
  assertNotNull(result[1]);
  assertEquals("list2@example.org", result[1].getAddress());
}

代码示例来源:origin: k9mail/k-9

@Test
public void parse_withQuotedEncodedPersonal_shouldDecode() {
  Address[] addresses = Address.parse(
      "\"=?UTF-8?B?WWFob28h44OA44Kk44Os44Kv44OI44Kq44OV44Kh44O8?= \"<directoffer-master@mail.yahoo.co.jp>");
  assertEquals("Yahoo!ダイレクトオファー ", addresses[0].getPersonal());
  assertEquals("directoffer-master@mail.yahoo.co.jp", addresses[0].getAddress());
}

代码示例来源:origin: k9mail/k-9

@Test
public void parse_withEncodedPersonal_shouldDecode() {
  Address[] addresses = Address.parse(
      "=?UTF-8?B?WWFob28h44OA44Kk44Os44Kv44OI44Kq44OV44Kh44O8?= <directoffer-master@mail.yahoo.co.jp>");
  assertEquals("Yahoo!ダイレクトオファー", addresses[0].getPersonal());
  assertEquals("directoffer-master@mail.yahoo.co.jp", addresses[0].getAddress());
}

代码示例来源:origin: k9mail/k-9

private Identity createIdentity() {
    Identity identity = new Identity();
    identity.setName(TEST_IDENTITY_ADDRESS.getPersonal());
    identity.setEmail(TEST_IDENTITY_ADDRESS.getAddress());
    identity.setDescription("test identity");
    identity.setSignatureUse(false);
    return identity;
  }
}

相关文章