Created
July 17, 2015 21:17
-
-
Save peterclemenko/00f1e617cc00742ec9c7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private ChatGroups getChatGroups(GenericSqliteHelper helper) { | |
// SQLiteDatabase db = helper.getReadableDatabase(); | |
final ChatGroups groups = new ChatGroups(); | |
RecordVisitor visitor = new RecordVisitor() { | |
@Override | |
public long cursor(Cursor cursor) { | |
String key = cursor.getString(0); | |
String mids = cursor.getString(2); | |
String names = cursor.getString(3); | |
String[] ms = mids.split(";"); | |
String[] ns = names.split(","); | |
for (int i = 0; i < ms.length; i++) { | |
String id = ms[i].trim(); | |
String name = ns[i].trim(); | |
groups.addPeerToGroup(key, new Contact(id, name, name, null)); | |
} | |
if (Cfg.DEBUG) { | |
Check.log(TAG + " (getChatGroups) %s", key); | |
} | |
return 0; | |
} | |
}; | |
helper.traverseRecords(M.e("chatroom"), visitor); | |
return groups; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment