mirror of
https://github.com/Mrs4s/MiraiGo.git
synced 2025-05-04 11:07:40 +08:00
commit
9991d8f398
@ -38,7 +38,7 @@ type QQClient struct {
|
|||||||
GroupList []*GroupInfo
|
GroupList []*GroupInfo
|
||||||
Online bool
|
Online bool
|
||||||
|
|
||||||
SequenceId uint16
|
SequenceId int32
|
||||||
OutGoingPacketSessionId []byte
|
OutGoingPacketSessionId []byte
|
||||||
RandomKey []byte
|
RandomKey []byte
|
||||||
Conn net.Conn
|
Conn net.Conn
|
||||||
@ -77,8 +77,6 @@ type QQClient struct {
|
|||||||
|
|
||||||
groupListLock sync.Mutex
|
groupListLock sync.Mutex
|
||||||
msgSvcLock sync.Mutex
|
msgSvcLock sync.Mutex
|
||||||
|
|
||||||
seqLock sync.Mutex
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type loginSigInfo struct {
|
type loginSigInfo struct {
|
||||||
@ -184,10 +182,10 @@ func (c *QQClient) GetGroupHonorInfo(groupCode int64, honorType HonorType) (*Gro
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
rsp := string(b)
|
b = b[bytes.Index(b, []byte(`window.__INITIAL_STATE__=`))+25:]
|
||||||
data := strings.Split(strings.Split(rsp, `window.__INITIAL_STATE__=`)[1], "</script>")[0]
|
b = b[:bytes.Index(b, []byte("</script>"))]
|
||||||
ret := GroupHonorInfo{}
|
ret := GroupHonorInfo{}
|
||||||
err = json.Unmarshal([]byte(data), &ret)
|
err = json.Unmarshal(b, &ret)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -825,45 +823,27 @@ func (c *QQClient) registerClient() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *QQClient) nextSeq() uint16 {
|
func (c *QQClient) nextSeq() uint16 {
|
||||||
c.seqLock.Lock()
|
return uint16(atomic.AddInt32(&c.SequenceId, 1) & 0x7FFF)
|
||||||
defer c.seqLock.Unlock()
|
|
||||||
|
|
||||||
c.SequenceId++
|
|
||||||
c.SequenceId &= 0x7FFF
|
|
||||||
if c.SequenceId == 0 {
|
|
||||||
c.SequenceId++
|
|
||||||
}
|
|
||||||
return c.SequenceId
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *QQClient) nextPacketSeq() int32 {
|
func (c *QQClient) nextPacketSeq() int32 {
|
||||||
s := atomic.LoadInt32(&c.requestPacketRequestId)
|
return atomic.AddInt32(&c.requestPacketRequestId, 2)
|
||||||
atomic.AddInt32(&c.requestPacketRequestId, 2)
|
|
||||||
return s
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *QQClient) nextGroupSeq() int32 {
|
func (c *QQClient) nextGroupSeq() int32 {
|
||||||
s := atomic.LoadInt32(&c.groupSeq)
|
return atomic.AddInt32(&c.groupSeq, 2)
|
||||||
atomic.AddInt32(&c.groupSeq, 2)
|
|
||||||
return s
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *QQClient) nextFriendSeq() int32 {
|
func (c *QQClient) nextFriendSeq() int32 {
|
||||||
s := atomic.LoadInt32(&c.friendSeq)
|
return atomic.AddInt32(&c.friendSeq, 1)
|
||||||
atomic.AddInt32(&c.friendSeq, 1)
|
|
||||||
return s
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *QQClient) nextGroupDataTransSeq() int32 {
|
func (c *QQClient) nextGroupDataTransSeq() int32 {
|
||||||
s := atomic.LoadInt32(&c.groupDataTransSeq)
|
return atomic.AddInt32(&c.groupDataTransSeq, 2)
|
||||||
atomic.AddInt32(&c.groupDataTransSeq, 2)
|
|
||||||
return s
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *QQClient) nextHighwayApplySeq() int32 {
|
func (c *QQClient) nextHighwayApplySeq() int32 {
|
||||||
s := atomic.LoadInt32(&c.highwayApplyUpSeq)
|
return atomic.AddInt32(&c.highwayApplyUpSeq, 2)
|
||||||
atomic.AddInt32(&c.highwayApplyUpSeq, 2)
|
|
||||||
return s
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *QQClient) send(pkt []byte) error {
|
func (c *QQClient) send(pkt []byte) error {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user