search for muc pms when fetching last mam reference

This commit is contained in:
Daniel Gultsch 2018-04-21 16:57:29 +02:00
parent 5e1bbea5f0
commit b501f4cf72

View file

@ -889,7 +889,7 @@ public class DatabaseBackend extends SQLiteOpenHelper {
Cursor cursor = null; Cursor cursor = null;
try { try {
SQLiteDatabase db = this.getReadableDatabase(); SQLiteDatabase db = this.getReadableDatabase();
String sql = "select messages.timeSent,messages.serverMsgId from accounts join conversations on accounts.uuid=conversations.accountUuid join messages on conversations.uuid=messages.conversationUuid where accounts.uuid=? and (messages.status=0 or messages.carbon=1 or messages.serverMsgId not null) and conversations.mode=0 order by messages.timesent desc limit 1"; String sql = "select messages.timeSent,messages.serverMsgId from accounts join conversations on accounts.uuid=conversations.accountUuid join messages on conversations.uuid=messages.conversationUuid where accounts.uuid=? and (messages.status=0 or messages.carbon=1 or messages.serverMsgId not null) and (conversations.mode=0 or (messages.serverMsgId not null and messages.type=4)) order by messages.timesent desc limit 1";
String[] args = {account.getUuid()}; String[] args = {account.getUuid()};
cursor = db.rawQuery(sql, args); cursor = db.rawQuery(sql, args);
if (cursor.getCount() == 0) { if (cursor.getCount() == 0) {