Mirror the group-history fetch for private chats via SsoGetC2cMsg (trpc.msg.register_proxy.RegisterProxy.SsoGetC2cMsg, fields per Lagrange: flat friendUid/start/end request, messages@7 response). get_friend_msg_history now resolves the anchor sequence + the friend's UID, fetches real history from the server, converts + persists each message, and falls back to the local store on unknown anchor / no uid / empty / error. - protocol: fetchC2cMessageRange (decodes via the friend decoder). - core: the group + c2c fetch now share a generic walkBackHistory loop (same throttle gate + caps); added MessageApi.getC2cHistory. - onebot: getFriendHistory + a generalized persistHistoryEvent (keys private by sender uin, exactly like the live path — so reply to old private messages resolves too). Tests: SsoGetC2cMsg request/response round-trip + friend-decode reuse.
20 lines
742 B
TypeScript
20 lines
742 B
TypeScript
import type { pb, pb_repeated, uint_32 } from '@snowluma/proton';
|
|
import type { PushMsgBody } from './message';
|
|
|
|
// trpc.msg.register_proxy.RegisterProxy.SsoGetC2cMsg — fetch private (c2c)
|
|
// message history from the server by sequence range. Reference: Lagrange.Core
|
|
// Internal/Service/Message/GetC2cMessageService.cs + Packets/Message/Action/
|
|
// SsoGetC2cMsg(.Response).cs. The peer is the friend's UID (not uin); the
|
|
// response carries the same `PushMsgBody` shape as a live message.
|
|
|
|
export interface SsoGetC2cMsg {
|
|
friendUid?: pb<2, string>;
|
|
startSequence?: pb<3, uint_32>;
|
|
endSequence?: pb<4, uint_32>;
|
|
}
|
|
|
|
export interface SsoGetC2cMsgResponse {
|
|
friendUid?: pb<4, string>;
|
|
messages?: pb_repeated<7, PushMsgBody>;
|
|
}
|