Fix function signature

This commit is contained in:
Changhua 2025-01-31 10:51:35 +08:00
parent b109bd72d2
commit 065db1d236
3 changed files with 12 additions and 12 deletions

View File

@ -3,15 +3,15 @@
#include "contact_mgmt.h"
#include "fill_response.h"
#include "log.hpp"
#include "pb_util.h"
#include "util.h"
using namespace std;
namespace contact_mgmt
{
extern QWORD g_WeChatWinDllAddr;
namespace contact_mgmt
{
#define OS_GET_CONTACT_MGR 0x1B417A0
#define OS_GET_CONTACT_LIST 0x219ED10
#define OS_CONTACT_BIN 0x200
@ -98,7 +98,7 @@ vector<RpcContact_t> get_contacts()
return contacts;
}
int accept_new_friend(string v3, string v4, int scene)
int accept_new_friend(const std::string &v3, const std::string &v4, int scene)
{
int success = -1;
#if 0
@ -149,7 +149,7 @@ int accept_new_friend(string v3, string v4, int scene)
return success; // 成功返回 1
}
RpcContact_t get_contact_by_wxid(string wxid)
RpcContact_t get_contact_by_wxid(const string &wxid)
{
RpcContact_t contact;
#if 0
@ -214,7 +214,7 @@ bool rpc_get_contact_info(const string &wxid, uint8_t *out, size_t *len)
bool rpc_accept_friend(const string &v3, const string &v4, int scene, uint8_t *out, size_t *len)
{
return fill_response<Functions_FUNC_ACCEPT_FRIEND>(
out, len, [&](Response &rsp) { rsp.msg.status = accept_friend(v3, v4, scene); });
out, len, [&](Response &rsp) { rsp.msg.status = accept_new_friend(v3, v4, scene); });
}
} // namespace contact_mgmt

View File

@ -15,7 +15,7 @@ std::vector<RpcContact_t> get_contacts();
RpcContact_t get_contact_by_wxid(const std::string &wxid);
// 接受好友请求
int accept_friend(const std::string &v3, const std::string &v4, int scene);
int accept_new_friend(const std::string &v3, const std::string &v4, int scene);
// 发送好友请求
// int add_friend_by_wxid(const std::string &wxid, const std::string &msg);

View File

@ -103,9 +103,9 @@ static bool func_get_msg_types(uint8_t *out, size_t *len)
static bool func_get_contacts(uint8_t *out, size_t *len)
{
return FillResponse<Functions_FUNC_GET_CONTACTS>(Response_contacts_tag, out, len, [](Response &rsp) {
static std::vector<RpcContact_t> contacts = contact_mgmt::get_contacts();
rsp.msg.contacts.contacts.funcs.encode = encode_contacts;
rsp.msg.contacts.contacts.arg = &contacts;
std::vector<RpcContact_t> contacts = contact_mgmt::get_contacts();
rsp.msg.contacts.contacts.funcs.encode = encode_contacts;
rsp.msg.contacts.contacts.arg = &contacts;
});
}
@ -417,7 +417,7 @@ static bool func_accept_friend(char *v3, char *v4, int32_t scene, uint8_t *out,
LOG_ERROR("Empty V3 or V4.");
rsp.msg.status = -1;
} else {
rsp.msg.status = contact_mgmt::accept_friend(v3, v4, scene);
rsp.msg.status = contact_mgmt::accept_new_friend(v3, v4, scene);
}
});
}
@ -425,7 +425,7 @@ static bool func_accept_friend(char *v3, char *v4, int32_t scene, uint8_t *out,
static bool func_get_contact_info(std::string wxid, uint8_t *out, size_t *len)
{
return FillResponse<Functions_FUNC_GET_CONTACT_INFO>(Response_contacts_tag, out, len, [wxid](Response &rsp) {
std::vector<RpcContact_t> contacts = contact_mgmt::get_contact_by_wxid(wxid);
std::vector<RpcContact_t> contacts = { contact_mgmt::get_contact_by_wxid(wxid) };
rsp.msg.contacts.contacts.funcs.encode = encode_contacts;
rsp.msg.contacts.contacts.arg = &contacts;
});