mirror of
https://github.com/Mrs4s/MiraiGo.git
synced 2025-05-07 12:43:32 +08:00
Merge branch 'master' of https://github.com/Mrs4s/MiraiGo
This commit is contained in:
commit
5e9e9b843b
@ -87,7 +87,6 @@ type QQClient struct {
|
||||
eventHandlers *eventHandlers
|
||||
|
||||
groupListLock sync.Mutex
|
||||
msgSvcLock sync.Mutex
|
||||
}
|
||||
|
||||
type loginSigInfo struct {
|
||||
@ -176,15 +175,7 @@ func NewClientMd5(uin int64, passwordMd5 [16]byte) *QQClient {
|
||||
transCache: utils.NewCache(time.Second * 15),
|
||||
onlinePushCache: utils.NewCache(time.Second * 15),
|
||||
version: genVersionInfo(SystemDeviceInfo.Protocol),
|
||||
servers: []*net.TCPAddr{ // default servers
|
||||
{IP: net.IP{42, 81, 169, 46}, Port: 8080},
|
||||
{IP: net.IP{42, 81, 172, 81}, Port: 80},
|
||||
{IP: net.IP{114, 221, 148, 59}, Port: 14000},
|
||||
{IP: net.IP{42, 81, 172, 147}, Port: 443},
|
||||
{IP: net.IP{125, 94, 60, 146}, Port: 80},
|
||||
{IP: net.IP{114, 221, 144, 215}, Port: 80},
|
||||
{IP: net.IP{42, 81, 172, 22}, Port: 80},
|
||||
},
|
||||
servers: []*net.TCPAddr{},
|
||||
}
|
||||
adds, err := net.LookupIP("msfwifi.3g.qq.com") // host servers
|
||||
if err == nil && len(adds) > 0 {
|
||||
@ -201,6 +192,16 @@ func NewClientMd5(uin int64, passwordMd5 [16]byte) *QQClient {
|
||||
if err == nil && len(sso) > 0 {
|
||||
cli.servers = append(sso, cli.servers...)
|
||||
}
|
||||
if len(cli.servers) == 0 {
|
||||
cli.servers = []*net.TCPAddr{ // default servers
|
||||
{IP: net.IP{42, 81, 172, 81}, Port: 80},
|
||||
{IP: net.IP{114, 221, 148, 59}, Port: 14000},
|
||||
{IP: net.IP{42, 81, 172, 147}, Port: 443},
|
||||
{IP: net.IP{125, 94, 60, 146}, Port: 80},
|
||||
{IP: net.IP{114, 221, 144, 215}, Port: 80},
|
||||
{IP: net.IP{42, 81, 172, 22}, Port: 80},
|
||||
}
|
||||
}
|
||||
rand.Read(cli.RandomKey)
|
||||
return cli
|
||||
}
|
||||
@ -1133,6 +1134,7 @@ func (c *QQClient) netLoop() {
|
||||
|
||||
func (c *QQClient) doHeartbeat() {
|
||||
c.heartbeatEnabled = true
|
||||
times := 0
|
||||
for c.Online {
|
||||
seq := c.nextSeq()
|
||||
sso := packets.BuildSsoPacket(seq, c.version.AppId, "Heartbeat.Alive", SystemDeviceInfo.IMEI, []byte{}, c.OutGoingPacketSessionId, []byte{}, c.ksid)
|
||||
@ -1143,6 +1145,11 @@ func (c *QQClient) doHeartbeat() {
|
||||
c.Disconnect()
|
||||
break
|
||||
}
|
||||
times++
|
||||
if times >= 7 {
|
||||
_ = c.registerClient()
|
||||
times = 0
|
||||
}
|
||||
time.Sleep(time.Second * 30)
|
||||
}
|
||||
c.heartbeatEnabled = false
|
||||
|
@ -426,8 +426,6 @@ func decodeMsgSendResponse(c *QQClient, _ uint16, payload []byte) (interface{},
|
||||
|
||||
// MessageSvc.PushNotify
|
||||
func decodeSvcNotify(c *QQClient, _ uint16, _ []byte) (interface{}, error) {
|
||||
c.msgSvcLock.Lock()
|
||||
defer c.msgSvcLock.Unlock()
|
||||
_, err := c.sendAndWait(c.buildGetMessageRequestPacket(msg.SyncFlag_START, time.Now().Unix()))
|
||||
return nil, err
|
||||
}
|
||||
@ -708,6 +706,9 @@ func decodeOnlinePushReqPacket(c *QQClient, seq uint16, payload []byte) (interfa
|
||||
_ = proto.Unmarshal(r.ReadAvailable(), &b)
|
||||
if b.OptMsgRecall != nil {
|
||||
for _, rm := range b.OptMsgRecall.RecalledMsgList {
|
||||
if rm.MsgType == 2 {
|
||||
continue
|
||||
}
|
||||
c.dispatchGroupMessageRecalledEvent(&GroupMessageRecalledEvent{
|
||||
GroupCode: groupId,
|
||||
OperatorUin: b.OptMsgRecall.Uin,
|
||||
|
Loading…
x
Reference in New Issue
Block a user