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

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

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

Message.setSubject介绍

暂无

代码示例

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

  1. @Test
  2. public void extractMessage_withAttachment() throws Exception {
  3. BodyPart attachmentPart = bodypart("application/octet-stream");
  4. Message message = messageFromBody(multipart("mixed",
  5. bodypart("text/plain", "text"),
  6. attachmentPart
  7. ));
  8. message.setSubject(SUBJECT);
  9. AttachmentViewInfo attachmentViewInfo = mock(AttachmentViewInfo.class);
  10. setupAttachmentInfoForPart(attachmentPart, attachmentViewInfo);
  11. MessageViewInfo messageViewInfo = messageViewInfoExtractor.extractMessageForView(message, null,
  12. false);
  13. assertEquals("<pre class=\"k9mail\">text</pre>", messageViewInfo.text);
  14. assertSame(attachmentViewInfo, messageViewInfo.attachments.get(0));
  15. assertNull(messageViewInfo.cryptoResultAnnotation);
  16. assertTrue(messageViewInfo.extraAttachments.isEmpty());
  17. assertEquals(SUBJECT, messageViewInfo.subject);
  18. }

代码示例来源:origin: jberkel/sms-backup-plus

  1. private @Nullable Message messageFromMapSms(Map<String, String> msgMap) throws MessagingException {
  2. final String address = msgMap.get(Telephony.TextBasedSmsColumns.ADDRESS);
  3. if (TextUtils.isEmpty(address)) return null;
  4. PersonRecord record = personLookup.lookupPerson(address);
  5. if (!includePersonInBackup(record, DataType.SMS)) return null;
  6. final Message msg = new MimeMessage();
  7. msg.setSubject(getSubject(DataType.SMS, record));
  8. setBody(msg, new TextBody(msgMap.get(Telephony.TextBasedSmsColumns.BODY)));
  9. final int messageType = toInt(msgMap.get(Telephony.TextBasedSmsColumns.TYPE));
  10. if (Telephony.TextBasedSmsColumns.MESSAGE_TYPE_INBOX == messageType) {
  11. // Received message
  12. msg.setFrom(record.getAddress(addressStyle));
  13. msg.setRecipient(Message.RecipientType.TO, userAddress);
  14. } else {
  15. // Sent message
  16. msg.setRecipient(Message.RecipientType.TO, record.getAddress(addressStyle));
  17. msg.setFrom(userAddress);
  18. }
  19. Date sentDate;
  20. try {
  21. // TODO: should probably be TextBasedSmsColumns.DATE_SENT
  22. sentDate = new Date(Long.valueOf(msgMap.get(Telephony.TextBasedSmsColumns.DATE)));
  23. } catch (NumberFormatException n) {
  24. Log.e(TAG, ERROR_PARSING_DATE, n);
  25. sentDate = new Date();
  26. }
  27. headerGenerator.setHeaders(msg, msgMap, DataType.SMS, address, record, sentDate, messageType);
  28. return msg;
  29. }

代码示例来源:origin: jberkel/sms-backup-plus

  1. msg.setSubject(getSubject(DataType.CALLLOG, record));

代码示例来源:origin: jberkel/sms-backup-plus

  1. msg.setSubject(getSubject(DataType.MMS, details.getRecipient()));

相关文章