|
|
|
@ -109,14 +109,15 @@ public interface DaoMessage {
|
|
|
|
|
", CASE WHEN message.ui_flagged THEN 0 ELSE 1 END AS unflagged" +
|
|
|
|
|
", (SELECT COUNT(a.id) FROM attachment a WHERE a.message = message.id) AS attachments" +
|
|
|
|
|
|
|
|
|
|
", ((folder.type = '" + EntityFolder.ARCHIVE + "'" +
|
|
|
|
|
" OR folder.type = '" + EntityFolder.SENT + "')" +
|
|
|
|
|
" AND EXISTS (" +
|
|
|
|
|
" SELECT * FROM message m1" +
|
|
|
|
|
" JOIN folder f1 ON f1.id = m1.folder" +
|
|
|
|
|
" WHERE m1.id <> message.id" +
|
|
|
|
|
" AND m1.msgid = message.msgid" +
|
|
|
|
|
" AND f1.type <> folder.type)) AS duplicate" +
|
|
|
|
|
", ((folder.type = '" + EntityFolder.ARCHIVE + "' OR folder.type = '" + EntityFolder.SENT + "')" +
|
|
|
|
|
" AND EXISTS (" +
|
|
|
|
|
" SELECT * FROM message m1" +
|
|
|
|
|
" JOIN folder f1 ON f1.id = m1.folder" +
|
|
|
|
|
" WHERE m1.id <> message.id" +
|
|
|
|
|
" AND m1.msgid = message.msgid" +
|
|
|
|
|
" AND f1.type <> folder.type" +
|
|
|
|
|
" AND f1.type <> '" + EntityFolder.ARCHIVE + "'" +
|
|
|
|
|
" )) AS duplicate" +
|
|
|
|
|
|
|
|
|
|
" FROM message" +
|
|
|
|
|
" JOIN account ON account.id = message.account" +
|
|
|
|
|