fixed bug in find conference in database method

This commit is contained in:
iNPUTmice 2015-01-21 16:18:57 +01:00
parent 00c74503ab
commit 2dc69eea68
1 changed files with 6 additions and 3 deletions

View File

@ -220,10 +220,13 @@ public class DatabaseBackend extends SQLiteOpenHelper {
public Conversation findConversation(final Account account, final Jid contactJid) { public Conversation findConversation(final Account account, final Jid contactJid) {
SQLiteDatabase db = this.getReadableDatabase(); SQLiteDatabase db = this.getReadableDatabase();
String[] selectionArgs = { account.getUuid(), contactJid.toBareJid().toString() + "%" }; String[] selectionArgs = { account.getUuid(),
contactJid.toBareJid().toString() + "/%",
contactJid.toBareJid().toString()
};
Cursor cursor = db.query(Conversation.TABLENAME, null, Cursor cursor = db.query(Conversation.TABLENAME, null,
Conversation.ACCOUNT + "=? AND " + Conversation.CONTACTJID Conversation.ACCOUNT + "=? AND (" + Conversation.CONTACTJID
+ " like ?", selectionArgs, null, null, null); + " like ? OR "+Conversation.CONTACTJID+"=?)", selectionArgs, null, null, null);
if (cursor.getCount() == 0) if (cursor.getCount() == 0)
return null; return null;
cursor.moveToFirst(); cursor.moveToFirst();