IM/MP/Response.cpp

33 lines
663 B
C++

//
// Created by dongl on 23-4-21.
//
#include "Response.h"
Response::Response(mp::MP_TYPE type, mp::MP_SUB_TYPE subType, const std::string &username, const std::string &msg, const std::string &token) :
Mph(type),
Sri(subType, username, msg, token) {
}
Response::~Response() {
delete response;
}
void Response::init() {
response = new mp::response();
response->set_allocated_sri(sri);
mph->set_mpb_size( response->ByteSizeLong());
}
std::string Response::packet () {
init();
std::string temp;
temp.push_back(mph->ByteSizeLong());
mph->AppendToString(&temp);
response->AppendToString(&temp);
return temp;
}