mirror of
https://gitee.com/Zhaoxin59/my-chat_-client.git
synced 2026-02-14 09:01:50 +08:00
add button functionality
This commit is contained in:
@ -294,6 +294,75 @@ namespace model
|
||||
netClient.sendMessage(loginSessionId, chatSessionId, MessageType::TEXT_TYPE, content.toUtf8(), "");
|
||||
}
|
||||
|
||||
void DataCenter::changeNicknameAsync(const QString& nickname)
|
||||
{
|
||||
netClient.changeNickname(loginSessionId, nickname);
|
||||
}
|
||||
|
||||
void DataCenter::resetNickname(const QString& nickname)
|
||||
{
|
||||
if (myself == nullptr) {
|
||||
return;
|
||||
}
|
||||
myself->nickname = nickname;
|
||||
}
|
||||
|
||||
void DataCenter::changeDescriptionAsync(const QString& desc)
|
||||
{
|
||||
netClient.changeDescription(loginSessionId, desc);
|
||||
}
|
||||
|
||||
void DataCenter::resetDescription(const QString& desc)
|
||||
{
|
||||
if (myself == nullptr) {
|
||||
return;
|
||||
}
|
||||
myself->description = desc;
|
||||
}
|
||||
|
||||
void DataCenter::getVerifyCodeAsync(const QString& email)
|
||||
{
|
||||
//这个操作,不需要loginSessionId
|
||||
//
|
||||
netClient.getVerifyCode(email);
|
||||
}
|
||||
|
||||
void DataCenter::resetVerifyCodeId(const QString& verifyCodeId)
|
||||
{
|
||||
this->currentVerifyCodeId = verifyCodeId;
|
||||
}
|
||||
|
||||
const QString& DataCenter::getVerifyCodeId() const
|
||||
{
|
||||
return currentVerifyCodeId;
|
||||
}
|
||||
|
||||
void DataCenter::changePhoneAsync(const QString& email, const QString& verifyCodeId, const QString& verifyCode)
|
||||
{
|
||||
netClient.changeEmail(loginSessionId, email, verifyCodeId, verifyCode);
|
||||
}
|
||||
|
||||
void DataCenter::resetPhone(const QString& email)
|
||||
{
|
||||
if (myself == nullptr) {
|
||||
return;
|
||||
}
|
||||
myself->phone = email;
|
||||
}
|
||||
|
||||
void DataCenter::changeAvatarAsync(const QByteArray& imageBytes)
|
||||
{
|
||||
netClient.changeAvatar(loginSessionId, imageBytes);
|
||||
}
|
||||
|
||||
void DataCenter::resetAvatar(const QByteArray& avatar)
|
||||
{
|
||||
if (myself == nullptr) {
|
||||
return;
|
||||
}
|
||||
myself->avatar = makeIcon(avatar);
|
||||
}
|
||||
|
||||
ChatSessionInfo* DataCenter::findChatSessionById(const QString& chatSessionId)
|
||||
{
|
||||
if (chatSessionList == nullptr) {
|
||||
@ -347,6 +416,19 @@ namespace model
|
||||
chatSessionList->push_front(backup);
|
||||
}
|
||||
|
||||
UserInfo* DataCenter::findFriendById(const QString& userId)
|
||||
{
|
||||
if (this->friendList == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
for (auto& f : *friendList) {
|
||||
if (f.userId == userId) {
|
||||
return &f;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void DataCenter::setCurrentChatSessionId(const QString& chatSessionId)
|
||||
{
|
||||
this->currentChatSessionId = chatSessionId;
|
||||
|
||||
@ -134,6 +134,29 @@ namespace model
|
||||
//发送消息给服务器
|
||||
void sendTextMessageAsync(const QString& chatSessionId, const QString& content);
|
||||
|
||||
//修改用户昵称
|
||||
void changeNicknameAsync(const QString& nickname);
|
||||
void resetNickname(const QString& nickname);
|
||||
|
||||
//修改用户签名
|
||||
void changeDescriptionAsync(const QString& desc);
|
||||
void resetDescription(const QString& desc);
|
||||
|
||||
//获取邮箱验证码
|
||||
void getVerifyCodeAsync(const QString& email);
|
||||
void resetVerifyCodeId(const QString& verifyCodeId);
|
||||
|
||||
//获取verifyCodeId
|
||||
const QString& getVerifyCodeId() const;
|
||||
|
||||
//修改邮箱号码
|
||||
void changePhoneAsync(const QString& email, const QString& verifyCodeId, const QString& verifyCode);
|
||||
void resetPhone(const QString& email);
|
||||
|
||||
//修改头像
|
||||
void changeAvatarAsync(const QByteArray& imageBytes);
|
||||
void resetAvatar(const QByteArray& avatar);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
///辅助函数
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@ -144,6 +167,8 @@ namespace model
|
||||
ChatSessionInfo* findChatSessionByUserId(const QString& userId);
|
||||
//把指定的会话信息,放到列表头部
|
||||
void topCurrentChatSessionId(const ChatSessionInfo& chatSessionInfo);
|
||||
//根据用户id查询好友信息
|
||||
UserInfo* findFriendById(const QString& userId);
|
||||
|
||||
//设置/获取当前选中的会话
|
||||
void setCurrentChatSessionId(const QString& chatSessionId);
|
||||
@ -162,5 +187,10 @@ namespace model
|
||||
void sendMessageDone(MessageType messageType, const QByteArray& content, const QString& extraInfo);
|
||||
void updateLastMessage(const QString& chatSessionId);
|
||||
void receiveMessageDone(const Message& lastMessage);
|
||||
void changeNicknameDone();
|
||||
void changeDescriptionDone();
|
||||
void getVerifyCodeDone();
|
||||
void changePhoneDone();
|
||||
void changeAvatarDone();
|
||||
};
|
||||
} //end namespace model
|
||||
|
||||
Reference in New Issue
Block a user