qqc.setSort(jsonCategory.getInt("sort"));
store.addCategory(qqc);
}
// 处理好友基本信息列表 flag/uin/categories
for (int i = 0; i < jsonFriends.length(); i++) {
QQBuddy buddy = new QQBuddy();
JSONObject jsonFriend = jsonFriends.getJSONObject(i);
long uin = jsonFriend.getLong("uin");
buddy.setUin(uin);
buddy.setStatus(QQStatus.OFFLINE);
buddy.setClientType(QQClientType.UNKNOWN);
// 添加到列表中
int category = jsonFriend.getInt("categories");
QQCategory qqCategory = store.getCategoryByIndex(category);
buddy.setCategory(qqCategory);
qqCategory.getBuddyList().add(buddy);
// 记录引用
store.addBuddy(buddy);
}
// face/flag/nick/uin
for (int i = 0; i < jsonInfo.length(); i++) {
JSONObject info = jsonInfo.getJSONObject(i);
long uin = info.getLong("uin");
QQBuddy buddy = store.getBuddyByUin(uin);
buddy.setNickname(info.getString("nick"));
}
// uin/markname
for (int i = 0; i < jsonMarknames.length(); i++) {
JSONObject jsonMarkname = jsonMarknames.getJSONObject(i);
long uin = jsonMarkname.getLong("uin");
QQBuddy buddy = store.getBuddyByUin(uin);
if(buddy != null){
buddy.setMarkname(jsonMarkname.getString("markname"));
}
}
// vip_level/u/is_vip
for (int i = 0; i < jsonVipinfo.length(); i++) {
JSONObject vipInfo = jsonVipinfo.getJSONObject(i);
long uin = vipInfo.getLong("u");
QQBuddy buddy = store.getBuddyByUin(uin);
buddy.setVipLevel(vipInfo.getInt("vip_level"));
int isVip = vipInfo.getInt("is_vip");
if(isVip != 0) {
buddy.setVip(true);
} else {
buddy.setVip(false);
}
}
notifyActionEvent(QQActionEvent.Type.EVT_OK, store.getCategoryList());