IM/MC/api/user/UserOperation.h

39 lines
894 B
C++

//
// Created by dongl on 23-5-10.
//
#ifndef IM2_USEROPERATION_H
#define IM2_USEROPERATION_H
#include <string>
#include <optional>
#include "../../../MP/Request.h"
#include "event2/bufferevent.h"
#include "../core/Client.h"
#define LOGIN_ACCOUNT mp::MP_REQUEST_LOGIN_ACCOUNT
#define LOGIN_PHONE mp::MP_REQUEST_LOGIN_PHONE
#define LOGIN_EMAIL mp::MP_REQUEST_LOGIN_EMAIL
class UserOperation {
public:
explicit UserOperation(Client* bev);
virtual ~UserOperation();
public:
std::optional<std::string> login(const std::string& account, const std::string& password);
private:
std::string packet_base(mp::MP_TYPE, mp::MP_SUB_TYPE, const std::string &account, const std::string &password);
std::string login_packet(mp::MP_SUB_TYPE subType, const std::string &account, const std::string &password);
private:
Client* client;
};
#endif //IM2_USEROPERATION_H