// // 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, uint64_t target, uint64_t source, const std::string& data) : Mph(type), Body(target, source, data), 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; }