Added In-reply-to multi address support

pull/208/head
M66B 3 years ago
parent 29b36948f7
commit c9ff506dab

@ -5944,8 +5944,9 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
return null;
if (!TextUtils.isEmpty(message.inreplyto))
for (EntityMessage m : db.message().getMessagesByMsgId(message.account, message.inreplyto))
map.put(m.msgid, m);
for (String inreplyto : message.inreplyto.split(" "))
for (EntityMessage m : db.message().getMessagesByMsgId(message.account, inreplyto))
map.put(m.msgid, m);
if (!TextUtils.isEmpty(message.references))
for (String ref : message.references.split(" "))
@ -5970,7 +5971,8 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
start = ssb.length();
ssb.append("In-reply-to: ");
ssb.setSpan(new StyleSpan(Typeface.BOLD), start, ssb.length(), 0);
ssb.append(message.inreplyto).append("\n");
for (String inreplyto : message.inreplyto.split(" "))
ssb.append(inreplyto).append("\n");
}
if (!TextUtils.isEmpty(message.references)) {

@ -4242,11 +4242,12 @@ class Core {
List<EntityMessage> all = new ArrayList<>();
if (message.inreplyto != null) {
List<EntityMessage> replied = db.message().getMessagesByMsgId(folder.account, message.inreplyto);
if (replied != null)
all.addAll(replied);
}
if (message.inreplyto != null)
for (String inreplyto : message.inreplyto.split(" ")) {
List<EntityMessage> replied = db.message().getMessagesByMsgId(folder.account, inreplyto);
if (replied != null)
all.addAll(replied);
}
if (r.refid != null) {
List<EntityMessage> refs = db.message().getMessagesByMsgId(folder.account, r.refid);
if (refs != null)
@ -4261,7 +4262,8 @@ class Core {
}
for (EntityFolder f : map.values())
EntityOperation.queue(context, f, EntityOperation.REPORT, message.inreplyto, label);
for (String inreplyto : message.inreplyto.split(" "))
EntityOperation.queue(context, f, EntityOperation.REPORT, inreplyto, label);
}
}
} catch (Throwable ex) {

@ -6464,12 +6464,13 @@ public class FragmentCompose extends FragmentBase {
if (extras.getBoolean("archive")) {
EntityFolder archive = db.folder().getFolderByType(draft.account, EntityFolder.ARCHIVE);
if (archive != null) {
List<EntityMessage> messages = db.message().getMessagesByMsgId(draft.account, draft.inreplyto);
if (messages != null)
for (EntityMessage message : messages)
EntityOperation.queue(context, message, EntityOperation.MOVE, archive.id);
}
if (archive != null)
for (String inreplyto : draft.inreplyto.split(" ")) {
List<EntityMessage> messages = db.message().getMessagesByMsgId(draft.account, inreplyto);
if (messages != null)
for (EntityMessage message : messages)
EntityOperation.queue(context, message, EntityOperation.MOVE, archive.id);
}
}
}
}
@ -7954,18 +7955,15 @@ public class FragmentCompose extends FragmentBase {
return false;
}
List<EntityMessage> messages = db.message().getMessagesByMsgId(draft.account, draft.inreplyto);
if (messages == null || messages.size() == 0) {
args.putString("reason", "In-reply-to gone");
return false;
}
for (EntityMessage message : messages) {
EntityFolder folder = db.folder().getFolder(message.folder);
if (folder == null)
continue;
if (EntityFolder.INBOX.equals(folder.type) || EntityFolder.USER.equals(folder.type))
return true;
for (String inreplyto : draft.inreplyto.split(" ")) {
List<EntityMessage> messages = db.message().getMessagesByMsgId(draft.account, inreplyto);
for (EntityMessage message : messages) {
EntityFolder folder = db.folder().getFolder(message.folder);
if (folder == null)
continue;
if (EntityFolder.INBOX.equals(folder.type) || EntityFolder.USER.equals(folder.type))
return true;
}
}
args.putString("reason", "Not in inbox or unread");

@ -1314,7 +1314,7 @@ public class MessageHelper {
String getInReplyTo() throws MessagingException {
String[] a = getInReplyTos();
return (a.length < 1 ? null : a[0]);
return (a.length == 0 ? null : TextUtils.join(" ", a));
}
String[] getInReplyTos() throws MessagingException {

@ -566,21 +566,24 @@ public class ServiceSend extends ServiceBase implements SharedPreferences.OnShar
Long sid = null;
EntityFolder sent = null;
if (reply_move && !TextUtils.isEmpty(message.inreplyto)) {
List<EntityMessage> replied = db.message().getMessagesByMsgId(message.account, message.inreplyto);
if (replied != null)
for (EntityMessage m : replied)
if (!m.ui_hide) {
EntityFolder folder = db.folder().getFolder(m.folder);
if (folder != null &&
(EntityFolder.INBOX.equals(folder.type) ||
EntityFolder.ARCHIVE.equals(folder.type) ||
EntityFolder.USER.equals(folder.type))) {
sent = folder;
break;
if (reply_move && !TextUtils.isEmpty(message.inreplyto))
for (String inreplyto : message.inreplyto.split(" ")) {
List<EntityMessage> replied = db.message().getMessagesByMsgId(message.account, inreplyto);
if (replied != null)
for (EntityMessage m : replied)
if (!m.ui_hide) {
EntityFolder folder = db.folder().getFolder(m.folder);
if (folder != null &&
(EntityFolder.INBOX.equals(folder.type) ||
EntityFolder.ARCHIVE.equals(folder.type) ||
EntityFolder.USER.equals(folder.type))) {
sent = folder;
break;
}
}
}
}
if (sent != null)
break;
}
if (sent == null)
sent = db.folder().getFolderByType(message.account, EntityFolder.SENT);
@ -804,11 +807,12 @@ public class ServiceSend extends ServiceBase implements SharedPreferences.OnShar
}
// Mark replied
if (message.inreplyto != null) {
List<EntityMessage> replieds = db.message().getMessagesByMsgId(message.account, message.inreplyto);
for (EntityMessage replied : replieds)
EntityOperation.queue(this, replied, EntityOperation.ANSWERED, true);
}
if (message.inreplyto != null)
for (String inreplyto : message.inreplyto.split(" ")) {
List<EntityMessage> replieds = db.message().getMessagesByMsgId(message.account, inreplyto);
for (EntityMessage replied : replieds)
EntityOperation.queue(this, replied, EntityOperation.ANSWERED, true);
}
// Mark forwarded
if (message.wasforwardedfrom != null) {

Loading…
Cancel
Save