WeChatFerry icon indicating copy to clipboard operation
WeChatFerry copied to clipboard

[🐛BUG] 私聊场景缺少接收者ID

Open RedRiverCN opened this issue 2 years ago • 0 comments

描述这个 bug void DispatchMsg(DWORD reg) { WxMsg_t wxMsg;

wxMsg.id      = GET_QWORD(reg + g_WxCalls.recvMsg.msgId);
wxMsg.type    = GET_DWORD(reg + g_WxCalls.recvMsg.type);
wxMsg.is_self = GET_DWORD(reg + g_WxCalls.recvMsg.isSelf);
wxMsg.ts      = GET_DWORD(reg + g_WxCalls.recvMsg.ts);
wxMsg.content = GetStringByWstrAddr(reg + g_WxCalls.recvMsg.content);
wxMsg.sign    = GetStringByStrAddr(reg + g_WxCalls.recvMsg.sign);
wxMsg.xml     = GetStringByStrAddr(reg + g_WxCalls.recvMsg.msgXml);

string roomid = GetStringByWstrAddr(reg + g_WxCalls.recvMsg.roomId);
if (roomid.find("@chatroom") != string::npos) { // 群 ID 的格式为 xxxxxxxxxxx@chatroom
    wxMsg.is_group = true;
    wxMsg.roomid   = roomid;
    if (wxMsg.is_self) {
        wxMsg.sender = GetSelfWxid();
    } else {
        wxMsg.sender = GetStringByStrAddr(reg + g_WxCalls.recvMsg.wxid);
    }
} else {
    wxMsg.is_group = false;
     ** 在此处是私聊场景 **
    if (wxMsg.is_self) {
         ** 假设我是A,与B私聊,发送者是我A,则本条消息丢失了接收者B的信息,只知道是我A发出的,而不知道是我发给谁的 **
         ** 因为B的信息存储在0x48偏移也就是roomid中,也就是缺少了这句wxMsg.roomid   = roomid; **
         ** 也可以考虑新增一个字段来表示接收者 wxMsg.receiver= roomid; **
        wxMsg.sender = GetSelfWxid();  
    } else {
        wxMsg.sender = roomid;
    }
}

... }

RedRiverCN avatar Jul 24 '23 09:07 RedRiverCN