IM_Client/api/MP/Request.cpp
dongl a67f301e79 现在只能添加直接添加的 待和server修改
已修改
请求包添加了几个函数
add修改
待完善
addfriendswindow 界面
添加好友后好友列表立马回显
2023-06-18 18:42:58 +08:00

64 lines
1.4 KiB
C++

//
// Created by dongl on 23-4-21.
//
#include "Request.h"
// 账户或者 手机号|邮箱|账户 请求 登陆注册
Request::Request(mp::MP_TYPE type, mp::MP_SUB_TYPE subType, const std::string& account, const std::string& password) :
Mph(type), Body(subType, account, password), Cqi() {
}
// IM 文本聊天请求
Request::Request(mp::MP_TYPE type, mp::MP_SUB_TYPE subType, uint64_t target, uint64_t source, const std::string& data) :
Mph(type), Body(subType, target, source, data), Cqi() {
}
Request::Request(mp::MP_TYPE type, mp::MP_SUB_TYPE subType, uint64_t target, uint64_t source) :
Mph(type), Body(subType, target, source), Cqi() {
}
Request::Request(mp::MP_TYPE type, mp::MP_SUB_TYPE subType,const std::string &account,
const std::string &password,const std::string &data) :
Mph(type), Body(subType, account, password, data) {
}
Request::Request(mp::MP_TYPE type, mp::MP_SUB_TYPE subType, const std::string &account) :
Mph(type), Body(subType, account), Cqi(){
}
Request::~Request() {
delete request;
}
void Request::init() {
request = new mp::request();
request->set_allocated_body(body);
request->set_allocated_cqi(cqi);
mph->set_mpb_size(request->ByteSizeLong());
}
std::string Request::packet() {
init();
std::string temp;
temp.push_back(mph->ByteSizeLong());
mph->AppendToString(&temp);
request->AppendToString(&temp);
return temp;
}