refactor: sync sparse tlprofile runtime

This commit is contained in:
A 2026-07-16 21:36:32 +08:00
parent 5ecf4e912d
commit 25ab04a254
93 changed files with 2983 additions and 1615 deletions

View file

@ -4,23 +4,38 @@ import (
"context"
"github.com/iamxvbaba/td/tg"
"github.com/iamxvbaba/td/tlprofile"
)
// 群通话范围外入口的被动 stub(防点崩)。未列出的 phone.*(conference 族 /
// 通话内消息族 / scheduled / RTMP)走 router fallback:400/500 NOT_IMPLEMENTED +
// 兼容矩阵日志,客户端不断连。
func (r *Router) registerPhoneStubs(d *tg.ServerDispatcher) {
func (r *Router) registerPhoneStubs(d *tlprofile.Dispatcher) {
registerRPC[
// 入会身份候选:真实实现见 phone_group_call.go(self + admin 的频道身份)。
d.OnPhoneGetGroupCallJoinAs(r.onPhoneGetGroupCallJoinAs)
// default join-as 偏好持久化仍是 stub(chatFull.groupcall_default_join_as 不回填)。
d.OnPhoneSaveDefaultGroupCallJoinAs(func(ctx context.Context, req *tg.PhoneSaveDefaultGroupCallJoinAsRequest) (bool, error) {
*tg.PhoneGetGroupCallJoinAsRequest](d, tlprofile.SemanticMethodPhoneGetGroupCallJoinAs, func(ctx context.
// default join-as 偏好持久化仍是 stub(chatFull.groupcall_default_join_as 不回填)。
Context, layerRequest *tg.PhoneGetGroupCallJoinAsRequest) (any, error) {
return r.onPhoneGetGroupCallJoinAs(ctx, layerRequest.
Peer)
})
registerRPC[*tg.PhoneSaveDefaultGroupCallJoinAsRequest](d, tlprofile.SemanticMethodPhoneSaveDefaultGroupCallJoinAs, func(ctx context.Context, req *tg.PhoneSaveDefaultGroupCallJoinAsRequest) (any, error) {
return true, nil
})
registerRPC[
// 录制范围外:客户端只看 record_start_date(恒不下发),打发掉即可。
d.OnPhoneToggleGroupCallRecord(func(ctx context.Context, req *tg.PhoneToggleGroupCallRecordRequest) (tg.UpdatesClass, error) {
*tg.PhoneToggleGroupCallRecordRequest](d, tlprofile.SemanticMethodPhoneToggleGroupCallRecord, func(ctx context.Context, req *tg.PhoneToggleGroupCallRecordRequest) (any, error) {
return tgEmptyUpdates(int(r.clock.Now().Unix())), nil
})
registerRPC[
// RTMP 直播(Live Stream):真实 handler 见 phone_group_call_rtmp.go。
d.OnPhoneGetGroupCallStreamChannels(r.onPhoneGetGroupCallStreamChannels)
d.OnPhoneGetGroupCallStreamRtmpURL(r.onPhoneGetGroupCallStreamRtmpURL)
*tg.PhoneGetGroupCallStreamChannelsRequest](d, tlprofile.SemanticMethodPhoneGetGroupCallStreamChannels, func(ctx context.Context, layerRequest *tg.PhoneGetGroupCallStreamChannelsRequest) (any, error) {
return r.onPhoneGetGroupCallStreamChannels(ctx, layerRequest.
Call)
})
registerRPC[*tg.PhoneGetGroupCallStreamRtmpURLRequest](d, tlprofile.SemanticMethodPhoneGetGroupCallStreamRtmpURL, func(ctx context.Context, layerRequest *tg.PhoneGetGroupCallStreamRtmpURLRequest) (any, error) {
return r.onPhoneGetGroupCallStreamRtmpURL(ctx, layerRequest)
})
}