mirror of
https://gitee.com/Zhaoxin59/my-chat_-client.git
synced 2026-02-14 00:51:48 +08:00
add updateFriendList from network
This commit is contained in:
@ -163,4 +163,30 @@ namespace model
|
||||
myself->load(userInfo);
|
||||
}
|
||||
|
||||
QList<UserInfo>* DataCenter::getFriendList()
|
||||
{
|
||||
return friendList;
|
||||
}
|
||||
|
||||
void DataCenter::getFriendListAsync()
|
||||
{
|
||||
netClient.getFriendList(loginSessionId);
|
||||
}
|
||||
|
||||
void DataCenter::resetFriendList(std::shared_ptr<bite_im::GetFriendListRsp> resp)
|
||||
{
|
||||
if (friendList == nullptr) {
|
||||
friendList = new QList<UserInfo>();
|
||||
}
|
||||
friendList->clear();
|
||||
|
||||
QList<bite_im::UserInfo> friendListPB = resp->friendList();
|
||||
for (auto& f : friendListPB) {
|
||||
UserInfo userInfo;
|
||||
userInfo.load(f);
|
||||
friendList->push_back(userInfo);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} //end namespace model
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
#include <qstandardpaths.h>
|
||||
#include <QDir>
|
||||
#include <QJsonObject>
|
||||
//#include <QList>
|
||||
|
||||
#include "data.h"
|
||||
#include "../network/netclient.h"
|
||||
@ -101,8 +102,14 @@ namespace model
|
||||
//
|
||||
void resetMyself(std::shared_ptr<bite_im::GetUserInfoRsp> resp);
|
||||
|
||||
//通过网络获取好友列表
|
||||
QList<UserInfo>* getFriendList();
|
||||
void getFriendListAsync();
|
||||
void resetFriendList(std::shared_ptr<bite_im::GetFriendListRsp> resp);
|
||||
|
||||
signals:
|
||||
//自定义信号
|
||||
void getMyselfDone();
|
||||
void getFriendListDone();
|
||||
};
|
||||
} //end namespace model
|
||||
|
||||
Reference in New Issue
Block a user