mirror of
https://github.com/Mrs4s/MiraiGo.git
synced 2025-05-04 19:17:38 +08:00
style: rename channel to guild
This commit is contained in:
parent
dd7ff422b8
commit
7d6dafc215
@ -44,7 +44,7 @@ type QQClient struct {
|
|||||||
OnlineClients []*OtherClientInfo
|
OnlineClients []*OtherClientInfo
|
||||||
Online bool
|
Online bool
|
||||||
QiDian *QiDianAccountInfo
|
QiDian *QiDianAccountInfo
|
||||||
ChannelService *ChannelService
|
GuildService *GuildService
|
||||||
|
|
||||||
// protocol public field
|
// protocol public field
|
||||||
SequenceId int32
|
SequenceId int32
|
||||||
@ -213,7 +213,7 @@ func NewClientMd5(uin int64, passwordMd5 [16]byte) *QQClient {
|
|||||||
alive: true,
|
alive: true,
|
||||||
ecdh: crypto.NewEcdh(),
|
ecdh: crypto.NewEcdh(),
|
||||||
}
|
}
|
||||||
cli.ChannelService = &ChannelService{c: cli}
|
cli.GuildService = &GuildService{c: cli}
|
||||||
cli.ecdh.FetchPubKey(uin)
|
cli.ecdh.FetchPubKey(uin)
|
||||||
cli.UseDevice(SystemDeviceInfo)
|
cli.UseDevice(SystemDeviceInfo)
|
||||||
sso, err := getSSOAddress()
|
sso, err := getSSOAddress()
|
||||||
|
@ -11,8 +11,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type (
|
type (
|
||||||
// ChannelService 频道模块内自身的信息
|
// GuildService 频道模块内自身的信息
|
||||||
ChannelService struct {
|
GuildService struct {
|
||||||
TinyId uint64
|
TinyId uint64
|
||||||
Nickname string
|
Nickname string
|
||||||
AvatarUrl string
|
AvatarUrl string
|
||||||
@ -77,17 +77,17 @@ func (c *QQClient) syncChannelFirstView() {
|
|||||||
if err = proto.Unmarshal(rsp, firstViewRsp); err != nil {
|
if err = proto.Unmarshal(rsp, firstViewRsp); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
c.ChannelService.TinyId = firstViewRsp.GetSelfTinyid()
|
c.GuildService.TinyId = firstViewRsp.GetSelfTinyid()
|
||||||
c.ChannelService.GuildCount = firstViewRsp.GetGuildCount()
|
c.GuildService.GuildCount = firstViewRsp.GetGuildCount()
|
||||||
if self, err := c.ChannelService.GetUserProfile(c.ChannelService.TinyId); err == nil {
|
if self, err := c.GuildService.GetUserProfile(c.GuildService.TinyId); err == nil {
|
||||||
c.ChannelService.Nickname = self.Nickname
|
c.GuildService.Nickname = self.Nickname
|
||||||
c.ChannelService.AvatarUrl = self.AvatarUrl
|
c.GuildService.AvatarUrl = self.AvatarUrl
|
||||||
} else {
|
} else {
|
||||||
c.Error("get self guild profile error: %v", err)
|
c.Error("get self guild profile error: %v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *ChannelService) GetUserProfile(tinyId uint64) (*GuildUserProfile, error) {
|
func (s *GuildService) GetUserProfile(tinyId uint64) (*GuildUserProfile, error) {
|
||||||
seq := s.c.nextSeq()
|
seq := s.c.nextSeq()
|
||||||
flags := binary.DynamicProtoMessage{}
|
flags := binary.DynamicProtoMessage{}
|
||||||
for i := 3; i <= 29; i++ {
|
for i := 3; i <= 29; i++ {
|
||||||
@ -122,7 +122,7 @@ func (s *ChannelService) GetUserProfile(tinyId uint64) (*GuildUserProfile, error
|
|||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *ChannelService) GetGuildMembers(guildId uint64) (bots []*GuildMemberInfo, members []*GuildMemberInfo, admins []*GuildMemberInfo, err error) {
|
func (s *GuildService) GetGuildMembers(guildId uint64) (bots []*GuildMemberInfo, members []*GuildMemberInfo, admins []*GuildMemberInfo, err error) {
|
||||||
seq := s.c.nextSeq()
|
seq := s.c.nextSeq()
|
||||||
u1 := uint32(1)
|
u1 := uint32(1)
|
||||||
payload := s.c.packOIDBPackageDynamically(3931, 1, binary.DynamicProtoMessage{ // todo: 可能还需要处理翻页的情况?
|
payload := s.c.packOIDBPackageDynamically(3931, 1, binary.DynamicProtoMessage{ // todo: 可能还需要处理翻页的情况?
|
||||||
@ -170,7 +170,7 @@ func (s *ChannelService) GetGuildMembers(guildId uint64) (bots []*GuildMemberInf
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *ChannelService) GetGuildMemberProfileInfo(guildId, tinyId uint64) (*GuildUserProfile, error) {
|
func (s *GuildService) GetGuildMemberProfileInfo(guildId, tinyId uint64) (*GuildUserProfile, error) {
|
||||||
seq := s.c.nextSeq()
|
seq := s.c.nextSeq()
|
||||||
flags := binary.DynamicProtoMessage{}
|
flags := binary.DynamicProtoMessage{}
|
||||||
for i := 3; i <= 29; i++ {
|
for i := 3; i <= 29; i++ {
|
||||||
@ -227,7 +227,7 @@ func decodeChannelPushFirstView(c *QQClient, _ *incomingPacketInfo, payload []by
|
|||||||
return nil, errors.Wrap(err, "failed to unmarshal protobuf message")
|
return nil, errors.Wrap(err, "failed to unmarshal protobuf message")
|
||||||
}
|
}
|
||||||
if len(firstViewMsg.GuildNodes) > 0 {
|
if len(firstViewMsg.GuildNodes) > 0 {
|
||||||
c.ChannelService.Guilds = []*GuildInfo{}
|
c.GuildService.Guilds = []*GuildInfo{}
|
||||||
for _, guild := range firstViewMsg.GuildNodes {
|
for _, guild := range firstViewMsg.GuildNodes {
|
||||||
info := &GuildInfo{
|
info := &GuildInfo{
|
||||||
GuildId: guild.GetGuildId(),
|
GuildId: guild.GetGuildId(),
|
||||||
@ -247,8 +247,8 @@ func decodeChannelPushFirstView(c *QQClient, _ *incomingPacketInfo, payload []by
|
|||||||
AtAllSeq: meta.GetAtAllSeq(),
|
AtAllSeq: meta.GetAtAllSeq(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
info.Bots, info.Members, info.Admins, _ = c.ChannelService.GetGuildMembers(info.GuildId)
|
info.Bots, info.Members, info.Admins, _ = c.GuildService.GetGuildMembers(info.GuildId)
|
||||||
c.ChannelService.Guilds = append(c.ChannelService.Guilds, info)
|
c.GuildService.Guilds = append(c.GuildService.Guilds, info)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if len(firstViewMsg.ChannelMsgs) > 0 { // sync msg
|
if len(firstViewMsg.ChannelMsgs) > 0 { // sync msg
|
Loading…
x
Reference in New Issue
Block a user