mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-27 11:42:16 -05:00
Fixes for cketti's code review on pull req #472
Leave the hostname == null checks so we can fall back if a hostname is not found. Also convert message-id to upper case to match Apple Mail (for privacy).
This commit is contained in:
parent
38c90146e1
commit
d67a59b77f
@ -93,6 +93,16 @@ public class Address {
|
|||||||
return mAddress;
|
return mAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getHostname() {
|
||||||
|
int hostIdx = mAddress.lastIndexOf("@");
|
||||||
|
|
||||||
|
if (hostIdx == -1) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return mAddress.substring(hostIdx+1);
|
||||||
|
}
|
||||||
|
|
||||||
public void setAddress(String address) {
|
public void setAddress(String address) {
|
||||||
this.mAddress = address;
|
this.mAddress = address;
|
||||||
}
|
}
|
||||||
|
@ -321,21 +321,21 @@ public class MimeMessage extends Message {
|
|||||||
|
|
||||||
private String generateMessageId() {
|
private String generateMessageId() {
|
||||||
String hostname = null;
|
String hostname = null;
|
||||||
if (mFrom != null) {
|
|
||||||
int hostIdx = mFrom[0].getAddress().lastIndexOf("@");
|
if (mFrom != null && mFrom.length >= 1) {
|
||||||
hostname = mFrom[0].getAddress().substring(hostIdx);
|
hostname = mFrom[0].getHostname();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hostname == null && mReplyTo != null) {
|
if (hostname == null && mReplyTo != null && mReplyTo.length >= 1) {
|
||||||
int hostIdx = mReplyTo[0].getAddress().lastIndexOf("@");
|
hostname = mReplyTo[0].getHostname();
|
||||||
hostname = mReplyTo[0].getAddress().substring(hostIdx);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hostname != null) {
|
if (hostname == null) {
|
||||||
return "<" + UUID.randomUUID().toString() + hostname + ">";
|
hostname = "email.android.com";
|
||||||
} else {
|
|
||||||
return "<" + UUID.randomUUID().toString() + "@email.android.com>";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* We use upper case here to match Apple Mail Message-ID format (for privacy) */
|
||||||
|
return "<" + UUID.randomUUID().toString().toUpperCase(Locale.US) + "@" + hostname + ">";
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMessageId(String messageId) throws UnavailableStorageException {
|
public void setMessageId(String messageId) throws UnavailableStorageException {
|
||||||
|
@ -35,7 +35,7 @@ public class Settings {
|
|||||||
*
|
*
|
||||||
* @see SettingsExporter
|
* @see SettingsExporter
|
||||||
*/
|
*/
|
||||||
public static final int VERSION = 31;
|
public static final int VERSION = 32;
|
||||||
|
|
||||||
public static Map<String, Object> validate(int version, Map<String,
|
public static Map<String, Object> validate(int version, Map<String,
|
||||||
TreeMap<Integer, SettingsDescription>> settings,
|
TreeMap<Integer, SettingsDescription>> settings,
|
||||||
|
Loading…
Reference in New Issue
Block a user