mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-04 16:16:33 +02:00
Experiment: Outlook Thread-Index
This commit is contained in:
@@ -26,6 +26,7 @@ import android.content.SharedPreferences;
|
||||
import android.net.Uri;
|
||||
import android.system.ErrnoException;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Base64;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
@@ -86,6 +87,7 @@ import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Properties;
|
||||
import java.util.TimeZone;
|
||||
import java.util.UUID;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@@ -1390,11 +1392,35 @@ public class MessageHelper {
|
||||
boolean gmail_thread_id = prefs.getBoolean("gmail_thread_id", false);
|
||||
if (gmail_thread_id) {
|
||||
long thrid = ((GmailMessage) imessage).getThrId();
|
||||
Log.i("Gmail thread=" + thrid);
|
||||
if (thrid > 0)
|
||||
return "gmail:" + thrid;
|
||||
}
|
||||
}
|
||||
|
||||
// https://docs.microsoft.com/en-us/openspecs/exchange_server_protocols/ms-oxomsg/9e994fbb-b839-495f-84e3-2c8c02c7dd9b
|
||||
String tindex = imessage.getHeader("Thread-Index", null);
|
||||
try {
|
||||
if (tindex != null) {
|
||||
boolean outlook_thread_id = prefs.getBoolean("outlook_thread_id", false);
|
||||
if (outlook_thread_id) {
|
||||
byte[] data = Base64.decode(tindex, Base64.DEFAULT);
|
||||
if (data.length >= 22) {
|
||||
long msb = 0, lsb = 0;
|
||||
for (int i = 0 + 6; i < 8 + 6; i++)
|
||||
msb = (msb << 8) | (data[i] & 0xff);
|
||||
for (int i = 8 + 6; i < 16 + 6; i++)
|
||||
lsb = (lsb << 8) | (data[i] & 0xff);
|
||||
UUID guid = new UUID(msb, lsb);
|
||||
Log.i("Outlook thread=" + guid);
|
||||
return "outlook:" + guid;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Throwable ex) {
|
||||
Log.w(ex);
|
||||
}
|
||||
|
||||
String thread = null;
|
||||
String msgid = getMessageID();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user