OTR & another.im #23
|
@ -1112,6 +1112,37 @@ public class DatabaseBackend extends SQLiteOpenHelper {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean deleteConversation(final Account account, final Jid contactJid, final Jid counterpart) {
|
||||||
|
SQLiteDatabase db = this.getWritableDatabase();
|
||||||
|
|
||||||
|
if (counterpart != null) {
|
||||||
|
String[] selectionArgs = {account.getUuid(),
|
||||||
|
contactJid.asBareJid().toString() + "/%",
|
||||||
|
contactJid.asBareJid().toString(),
|
||||||
|
counterpart.toString()
|
||||||
|
};
|
||||||
|
|
||||||
|
int rows = db.delete(Conversation.TABLENAME,
|
||||||
|
Conversation.ACCOUNT + "=? AND (" + Conversation.CONTACTJID
|
||||||
|
+ " like ? OR " + Conversation.CONTACTJID + "=?) AND " + Conversation.NEXT_COUNTERPART + "=?", selectionArgs);
|
||||||
|
|
||||||
|
return rows == 1;
|
||||||
|
} else {
|
||||||
|
String[] selectionArgs = new String[]{
|
||||||
|
account.getUuid(),
|
||||||
|
contactJid.asBareJid().toString() + "/%",
|
||||||
|
contactJid.asBareJid().toString()
|
||||||
|
};
|
||||||
|
|
||||||
|
int rows = db.delete(Conversation.TABLENAME,
|
||||||
|
Conversation.ACCOUNT + "=? AND (" + Conversation.CONTACTJID
|
||||||
|
+ " like ? OR " + Conversation.CONTACTJID + "=?) AND " + Conversation.NEXT_COUNTERPART + " =NULL", selectionArgs);
|
||||||
|
|
||||||
|
return rows == 1;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void updateConversation(final Conversation conversation) {
|
public void updateConversation(final Conversation conversation) {
|
||||||
final SQLiteDatabase db = this.getWritableDatabase();
|
final SQLiteDatabase db = this.getWritableDatabase();
|
||||||
final String[] args = {conversation.getUuid()};
|
final String[] args = {conversation.getUuid()};
|
||||||
|
|
Loading…
Reference in a new issue