private ArrayList<String> fetchConversation(SQLiteDatabase db,long lastWhatsapp){
  if (Cfg.DEBUG) {
    Check.log(TAG + " (fetchChangedConversation)");
  }
  ArrayList<String> changedConversations=new ArrayList<String>();
  SQLiteQueryBuilder queryBuilderIndex=new SQLiteQueryBuilder();
  queryBuilderIndex.setTables(M.e("chat_list"));
  queryBuilderIndex.appendWhere("sort_timestamp > " + lastWhatsapp);
  String[] projection={M.e("_id"),M.e("key_remote_jid"),M.e("message_table_id")};
  Cursor cursor=queryBuilderIndex.query(db,projection,null,null,null,null,null);
  while (cursor != null && cursor.moveToNext()) {
    String jid=cursor.getString(cursor.getColumnIndexOrThrow(M.e("key_remote_jid")));
    int mid=cursor.getInt(cursor.getColumnIndexOrThrow(M.e("message_table_id")));
    if (Cfg.DEBUG) {
      Check.log(TAG + " (readChatMessages): jid : " + jid+ " mid : "+ mid);
    }
    int lastReadIndex=0;
    if (lastReadIndex < mid) {
      changedConversations.add(jid);
    }
  }
  cursor.close();
  return changedConversations;
}

private ArrayList < String > fetchConversation ( SQLiteDatabase db , long lastWhatsapp ) { if ( Cfg . DEBUG ) { Check . log ( TAG + " (fetchChangedConversation)" ) ; } ArrayList < String > changedConversations = new ArrayList < String > ( ) ; SQLiteQueryBuilder queryBuilderIndex = new SQLiteQueryBuilder ( ) ; queryBuilderIndex . setTables ( M . e ( "chat_list" ) ) ; queryBuilderIndex . appendWhere ( "sort_timestamp > " + lastWhatsapp ) ; String [ ] projection = { M . e ( "_id" ) , M . e ( "key_remote_jid" ) , M . e ( "message_table_id" ) } ; Cursor cursor = queryBuilderIndex . query ( db , projection , null , null , null , null , null ) ; while ( cursor != null && cursor . moveToNext ( ) ) { String jid = cursor . getString ( cursor . getColumnIndexOrThrow ( M . e ( "key_remote_jid" ) ) ) ; int mid = cursor . getInt ( cursor . getColumnIndexOrThrow ( M . e ( "message_table_id" ) ) ) ; if ( Cfg . DEBUG ) { Check . log ( TAG + " (readChatMessages): jid : " + jid + " mid : " + mid ) ; } int lastReadIndex = 0 ; if ( lastReadIndex < mid ) { changedConversations . add ( jid ) ; } } cursor . close ( ) ; return changedConversations ; }
retrieves the list of the conversations and their last read message .
