mirror of
https://github.com/pppscn/SmsForwarder
synced 2024-11-08 01:10:23 +00:00
修复:发件人昵称插入 {{接收时间}} 时转码失败(Nested Group)
优化:邮件主题、发件人昵称替换冒号、换行为 -
This commit is contained in:
parent
4a81c0d0a5
commit
f621237c15
@ -216,7 +216,7 @@ class PhoneUtils private constructor() {
|
||||
val indexDuration = cursor.getColumnIndex(CallLog.Calls.DURATION)
|
||||
val indexType = cursor.getColumnIndex(CallLog.Calls.TYPE)
|
||||
val indexViaNumber = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N && cursor.getColumnIndex("via_number") != -1) cursor.getColumnIndex("via_number") else -1
|
||||
var isSimId = false
|
||||
val isSimId = false
|
||||
var indexSimId = -1
|
||||
if (cursor.getColumnIndex("simid") != -1) {
|
||||
indexSimId = cursor.getColumnIndex("simid")
|
||||
@ -396,7 +396,7 @@ class PhoneUtils private constructor() {
|
||||
val indexBody = cursor.getColumnIndex("body")
|
||||
val indexDate = cursor.getColumnIndex("date")
|
||||
val indexType = cursor.getColumnIndex("type")
|
||||
var isSimId = false
|
||||
val isSimId = false
|
||||
var indexSimId = -1
|
||||
if (cursor.getColumnIndex("sim_id") != -1) {
|
||||
indexSimId = cursor.getColumnIndex("sim_id")
|
||||
|
@ -50,11 +50,15 @@ object MailUtil {
|
||||
if (TextUtils.isEmpty(mail.fromNickname)) {
|
||||
setFrom(InternetAddress(mail.fromAddress))
|
||||
} else {
|
||||
val nickname = try {
|
||||
MimeUtility.encodeText(mail.fromNickname)
|
||||
var nickname = mail.fromNickname.replace(":", "-").replace("\n", "-")
|
||||
try {
|
||||
Log.d("createMailMessage", "nickname = $nickname")
|
||||
nickname = MimeUtility.encodeText(nickname)
|
||||
} catch (e: UnsupportedEncodingException) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
|
||||
Log.d("createMailMessage", "nickname = $nickname")
|
||||
setFrom(InternetAddress("$nickname <${mail.fromAddress}>"))
|
||||
}
|
||||
|
||||
@ -77,7 +81,12 @@ object MailUtil {
|
||||
setRecipients(Message.RecipientType.BCC, bccAddress)
|
||||
|
||||
// 邮件主题
|
||||
subject = mail.subject
|
||||
subject = mail.subject.replace(":", "-").replace("\n", "-")
|
||||
try {
|
||||
subject = MimeUtility.encodeText(subject)
|
||||
} catch (e: UnsupportedEncodingException) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
|
||||
// 邮件内容
|
||||
val contentPart = MimeMultipart()
|
||||
|
Loading…
Reference in New Issue
Block a user