From 0f68dadc9a1741b8377b80500bdd61f50493617b Mon Sep 17 00:00:00 2001 From: Lin <767763591@qq.com> Date: Wed, 27 Oct 2021 10:03:19 +0800 Subject: [PATCH] =?UTF-8?q?chron:=20=E6=B7=BB=E5=8A=A0=E4=B8=8B=E5=88=92?= =?UTF-8?q?=E7=BA=BF=EF=BC=8C=E4=BF=AE=E6=94=B9=E6=96=87=E4=BB=B6=E6=9D=83?= =?UTF-8?q?=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/{c2c_decoders.go => _c2c_decoders.go} | 3 --- client/c2c_switch.go | 4 ++-- client/c2c_switcher.go | 10 +++++----- client/decoders.go | 2 +- 4 files changed, 8 insertions(+), 11 deletions(-) rename client/{c2c_decoders.go => _c2c_decoders.go} (97%) diff --git a/client/c2c_decoders.go b/client/_c2c_decoders.go similarity index 97% rename from client/c2c_decoders.go rename to client/_c2c_decoders.go index 0d0272da..72a72b44 100644 --- a/client/c2c_decoders.go +++ b/client/_c2c_decoders.go @@ -1,6 +1,3 @@ -//go:build ignore -// +build ignore - package client import "github.com/Mrs4s/MiraiGo/client/pb/msg" diff --git a/client/c2c_switch.go b/client/c2c_switch.go index e0fb94f4..fb9199ec 100644 --- a/client/c2c_switch.go +++ b/client/c2c_switch.go @@ -8,11 +8,11 @@ import ( const ( UnknownDecoder = iota - sysMsgDecoders - otherDecoders privateMsgDecoders nonSvcNotifyTroopSystemMsgDecoders troopSystemMsgDecoders + sysMsgDecoders + otherDecoders ) func peekC2CDecoder(msgType int32) (decoder func(*QQClient, *msg.Message, *incomingPacketInfo), decoderType uint8) { diff --git a/client/c2c_switcher.go b/client/c2c_switcher.go index 01088f55..058a6f03 100644 --- a/client/c2c_switcher.go +++ b/client/c2c_switcher.go @@ -59,7 +59,7 @@ func main() { var sf switchFile fset := token.NewFileSet() - astF, err := parser.ParseFile(fset, "c2c_decoders.go", nil, parser.AllErrors|parser.ParseComments) + astF, err := parser.ParseFile(fset, "_c2c_decoders.go", nil, parser.AllErrors|parser.ParseComments) if err != nil { panic(err) } @@ -72,7 +72,7 @@ func main() { sf.Consts = make([]string, 0, len(astF.Scope.Objects)) for _, obj := range astF.Scope.Objects { if obj.Kind != ast.Var { - panic(`unknown non-variable in "c2c_decoders.go"`) + panic(`unknown non-variable in "_c2c_decoders.go"`) } value := obj.Decl.(*ast.ValueSpec) sf.Consts = append(sf.Consts, obj.Name) @@ -88,17 +88,17 @@ func main() { DecoderType: obj.Name, }) } else { - panic(`unknown key value in ` + obj.Name + ` in "c2c_decoders.go"`) + panic(`unknown key value in ` + obj.Name + ` in "_c2c_decoders.go"`) } } } else { - panic(`unknown non-map value in "c2c_decoders.go"`) + panic(`unknown non-map value in "_c2c_decoders.go"`) } } } sort.Sort(sf.Decoders) - f, _ := os.OpenFile("c2c_switch.go", os.O_WRONLY|os.O_CREATE|os.O_SYNC|os.O_TRUNC, 0o755) + f, _ := os.OpenFile("c2c_switch.go", os.O_WRONLY|os.O_CREATE|os.O_SYNC|os.O_TRUNC, 0o644) tmpl, err := template.New("template").Parse(codeTemplate) if err != nil { panic(err) diff --git a/client/decoders.go b/client/decoders.go index 32a4d113..22602626 100644 --- a/client/decoders.go +++ b/client/decoders.go @@ -396,7 +396,7 @@ func decodeSvcNotify(c *QQClient, _ *incomingPacketInfo, payload []byte) (interf notify := &jce.RequestPushNotify{} notify.ReadFrom(jce.NewJceReader(data.Map["req_PushNotify"]["PushNotifyPack.RequestPushNotify"][1:])) if decoder, typ := peekC2CDecoder(notify.MsgType); decoder != nil { - // notify.MsgType != 85 && notify.MsgType != 36 moves to c2c_decoders.go [nonSvcNotifyTroopSystemMsgDecoders] + // notify.MsgType != 85 && notify.MsgType != 36 moves to _c2c_decoders.go [nonSvcNotifyTroopSystemMsgDecoders] if typ == troopSystemMsgDecoders { c.exceptAndDispatchGroupSysMsg() return nil, nil