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

x33g5p2x  于2022-01-25 转载在 其他  
字(6.7k)|赞(0)|评价(0)|浏览(272)

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

Message.getReplyTo介绍

暂无

代码示例

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

  1. public String generateMessageId(Message message) {
  2. String hostname = null;
  3. Address[] from = message.getFrom();
  4. if (from != null && from.length >= 1) {
  5. hostname = from[0].getHostname();
  6. }
  7. if (hostname == null) {
  8. Address[] replyTo = message.getReplyTo();
  9. if (replyTo != null && replyTo.length >= 1) {
  10. hostname = replyTo[0].getHostname();
  11. }
  12. }
  13. if (hostname == null) {
  14. hostname = "email.android.com";
  15. }
  16. String uuid = generateUuid();
  17. return "<" + uuid + "@" + hostname + ">";
  18. }

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

  1. @Test
  2. public void getRecipientsToReplyTo_should_prefer_from_ifOtherIsIdentity() throws Exception {
  3. when(message.getReplyTo()).thenReturn(REPLY_TO_ADDRESSES);
  4. when(message.getHeader(ListHeaders.LIST_POST_HEADER)).thenReturn(LIST_POST_HEADER_VALUES);
  5. when(message.getFrom()).thenReturn(FROM_ADDRESSES);
  6. when(message.getRecipients(RecipientType.TO)).thenReturn(TO_ADDRESSES);
  7. when(account.isAnIdentity(any(Address[].class))).thenReturn(true);
  8. ReplyToAddresses result = replyToParser.getRecipientsToReplyTo(message, account);
  9. assertArrayEquals(TO_ADDRESSES, result.to);
  10. assertArrayEquals(EMPTY_ADDRESSES, result.cc);
  11. }

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

  1. @Test
  2. public void getRecipientsToReplyAllTo_should_returnFromAndToAndCcRecipients() throws Exception {
  3. when(message.getReplyTo()).thenReturn(EMPTY_ADDRESSES);
  4. when(message.getHeader(ListHeaders.LIST_POST_HEADER)).thenReturn(new String[0]);
  5. when(message.getFrom()).thenReturn(FROM_ADDRESSES);
  6. when(message.getRecipients(RecipientType.TO)).thenReturn(TO_ADDRESSES);
  7. when(message.getRecipients(RecipientType.CC)).thenReturn(CC_ADDRESSES);
  8. ReplyToAddresses recipientsToReplyAllTo = replyToParser.getRecipientsToReplyAllTo(message, account);
  9. assertArrayEquals(arrayConcatenate(FROM_ADDRESSES, TO_ADDRESSES, Address.class), recipientsToReplyAllTo.to);
  10. assertArrayEquals(CC_ADDRESSES, recipientsToReplyAllTo.cc);
  11. }

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

  1. @Test
  2. public void getRecipientsToReplyTo_should_return_from_otherwise() throws Exception {
  3. when(message.getReplyTo()).thenReturn(EMPTY_ADDRESSES);
  4. when(message.getHeader(ListHeaders.LIST_POST_HEADER)).thenReturn(new String[0]);
  5. when(message.getFrom()).thenReturn(FROM_ADDRESSES);
  6. ReplyToAddresses result = replyToParser.getRecipientsToReplyTo(message, account);
  7. assertArrayEquals(FROM_ADDRESSES, result.to);
  8. assertArrayEquals(EMPTY_ADDRESSES, result.cc);
  9. verify(account).isAnIdentity(result.to);
  10. }

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

  1. @Test
  2. public void getRecipientsToReplyTo_should_prefer_replyTo_over_any_other_field() throws Exception {
  3. when(message.getReplyTo()).thenReturn(REPLY_TO_ADDRESSES);
  4. when(message.getHeader(ListHeaders.LIST_POST_HEADER)).thenReturn(LIST_POST_HEADER_VALUES);
  5. when(message.getFrom()).thenReturn(FROM_ADDRESSES);
  6. ReplyToAddresses result = replyToParser.getRecipientsToReplyTo(message, account);
  7. assertArrayEquals(REPLY_TO_ADDRESSES, result.to);
  8. assertArrayEquals(EMPTY_ADDRESSES, result.cc);
  9. verify(account).isAnIdentity(result.to);
  10. }

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

  1. @Test
  2. public void getRecipientsToReplyTo_should_prefer_listPost_over_from_field() throws Exception {
  3. when(message.getReplyTo()).thenReturn(EMPTY_ADDRESSES);
  4. when(message.getHeader(ListHeaders.LIST_POST_HEADER)).thenReturn(LIST_POST_HEADER_VALUES);
  5. when(message.getFrom()).thenReturn(FROM_ADDRESSES);
  6. ReplyToAddresses result = replyToParser.getRecipientsToReplyTo(message, account);
  7. assertArrayEquals(LIST_POST_ADDRESSES, result.to);
  8. assertArrayEquals(EMPTY_ADDRESSES, result.cc);
  9. verify(account).isAnIdentity(result.to);
  10. }

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

  1. public ReplyToAddresses getRecipientsToReplyTo(Message message, Account account) {
  2. Address[] candidateAddress;
  3. Address[] replyToAddresses = message.getReplyTo();
  4. Address[] listPostAddresses = ListHeaders.getListPostAddresses(message);
  5. Address[] fromAddresses = message.getFrom();
  6. if (replyToAddresses.length > 0) {
  7. candidateAddress = replyToAddresses;
  8. } else if (listPostAddresses.length > 0) {
  9. candidateAddress = listPostAddresses;
  10. } else {
  11. candidateAddress = fromAddresses;
  12. }
  13. boolean replyToAddressIsUserIdentity = account.isAnIdentity(candidateAddress);
  14. if (replyToAddressIsUserIdentity) {
  15. candidateAddress = message.getRecipients(RecipientType.TO);
  16. }
  17. return new ReplyToAddresses(candidateAddress);
  18. }

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

  1. @Test
  2. public void getRecipientsToReplyAllTo_should_excludeIdentityAddresses() throws Exception {
  3. when(message.getReplyTo()).thenReturn(EMPTY_ADDRESSES);
  4. when(message.getHeader(ListHeaders.LIST_POST_HEADER)).thenReturn(new String[0]);
  5. when(message.getFrom()).thenReturn(EMPTY_ADDRESSES);
  6. when(message.getRecipients(RecipientType.TO)).thenReturn(TO_ADDRESSES);
  7. when(message.getRecipients(RecipientType.CC)).thenReturn(CC_ADDRESSES);
  8. Address excludedCcAddress = CC_ADDRESSES[1];
  9. Address excludedToAddress = TO_ADDRESSES[0];
  10. when(account.isAnIdentity(eq(excludedToAddress))).thenReturn(true);
  11. when(account.isAnIdentity(eq(excludedCcAddress))).thenReturn(true);
  12. ReplyToAddresses recipientsToReplyAllTo = replyToParser.getRecipientsToReplyAllTo(message, account);
  13. assertArrayEquals(arrayExcept(TO_ADDRESSES, excludedToAddress), recipientsToReplyAllTo.to);
  14. assertArrayEquals(arrayExcept(CC_ADDRESSES, excludedCcAddress), recipientsToReplyAllTo.cc);
  15. }

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

  1. cv.put("cc_list", Address.pack(message.getRecipients(RecipientType.CC)));
  2. cv.put("bcc_list", Address.pack(message.getRecipients(RecipientType.BCC)));
  3. cv.put("reply_to_list", Address.pack(message.getReplyTo()));
  4. cv.put("attachment_count", attachmentCount);
  5. cv.put("internal_date", message.getInternalDate() == null

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

  1. @Test
  2. public void getRecipientsToReplyAllTo_should_excludeDuplicates() throws Exception {
  3. when(message.getReplyTo()).thenReturn(REPLY_TO_ADDRESSES);
  4. when(message.getFrom()).thenReturn(arrayConcatenate(FROM_ADDRESSES, REPLY_TO_ADDRESSES, Address.class));
  5. when(message.getRecipients(RecipientType.TO)).thenReturn(arrayConcatenate(FROM_ADDRESSES, TO_ADDRESSES, Address.class));
  6. when(message.getRecipients(RecipientType.CC)).thenReturn(arrayConcatenate(CC_ADDRESSES, TO_ADDRESSES, Address.class));
  7. when(message.getHeader(ListHeaders.LIST_POST_HEADER)).thenReturn(new String[0]);
  8. ReplyToAddresses recipientsToReplyAllTo = replyToParser.getRecipientsToReplyAllTo(message, account);
  9. assertArrayContainsAll(REPLY_TO_ADDRESSES, recipientsToReplyAllTo.to);
  10. assertArrayContainsAll(FROM_ADDRESSES, recipientsToReplyAllTo.to);
  11. assertArrayContainsAll(TO_ADDRESSES, recipientsToReplyAllTo.to);
  12. int totalExpectedAddresses = REPLY_TO_ADDRESSES.length + FROM_ADDRESSES.length + TO_ADDRESSES.length;
  13. assertEquals(totalExpectedAddresses, recipientsToReplyAllTo.to.length);
  14. assertArrayEquals(CC_ADDRESSES, recipientsToReplyAllTo.cc);
  15. }

相关文章