From 5425ea77cc900d132655936653c4164fad409e8d Mon Sep 17 00:00:00 2001 From: Him188 Date: Wed, 29 Jan 2020 13:36:48 +0800 Subject: [PATCH] Correct ProtoBuf package --- .../net/mamoe/mirai/qqandroid/io/ProtoBuf.kt | 7 + .../mirai/qqandroid/io/serialization/Jce.kt | 2 +- .../network/protocol/packet/PacketFactory.kt | 2 +- .../packet/chat/data/Cmd0x352Packet.kt | 2 +- .../protocol/packet/chat/data/ImageRequest.kt | 2 +- .../packet/chat/data/MessageCommon.kt | 61 -------- .../network/protocol/packet/chat/data/Msg.kt | 146 +++++++++--------- .../protocol/packet/chat/data/MsgCommon.kt | 8 +- .../protocol/packet/chat/data/MsgSvc.kt | 140 ++++++++--------- .../protocol/packet/chat/data/OnlinePush.kt | 6 +- .../packet/chat/image/GroupImageRequest.kt | 2 - .../chat/receive/MessageSvc.PushNotify.kt | 8 +- .../chat/receive/OnlinePush.PbPushGroupMsg.kt | 11 +- .../protocol/packet/chat/send/PbSendMsg.kt | 27 ++++ .../protocol/packet/login/LoginPacket.kt | 11 +- .../network/protocol/packet/login/Register.kt | 8 +- .../login/data}/RequestPacket.kt | 4 +- .../login/data}/SvcReqRegister.kt | 2 +- .../packet/oidb/oidb0x769/Oidb0x769.kt | 2 +- .../network/protocol/protobuf/ProtoBuf.kt | 7 - 20 files changed, 204 insertions(+), 254 deletions(-) create mode 100644 mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/io/ProtoBuf.kt delete mode 100644 mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/data/MessageCommon.kt delete mode 100644 mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/image/GroupImageRequest.kt create mode 100644 mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/send/PbSendMsg.kt rename mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/{jce => packet/login/data}/RequestPacket.kt (88%) rename mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/{jce => packet/login/data}/SvcReqRegister.kt (96%) delete mode 100644 mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/protobuf/ProtoBuf.kt diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/io/ProtoBuf.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/io/ProtoBuf.kt new file mode 100644 index 000000000..678540fb2 --- /dev/null +++ b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/io/ProtoBuf.kt @@ -0,0 +1,7 @@ +package net.mamoe.mirai.qqandroid.io + +/** + * 仅有标示作用 + */ +interface ProtoBuf { +} \ No newline at end of file diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/io/serialization/Jce.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/io/serialization/Jce.kt index c4fa4f6fd..9addfcd55 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/io/serialization/Jce.kt +++ b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/io/serialization/Jce.kt @@ -8,7 +8,7 @@ import kotlinx.serialization.modules.EmptyModule import kotlinx.serialization.modules.SerialModule import net.mamoe.mirai.qqandroid.io.JceStruct import net.mamoe.mirai.qqandroid.network.protocol.packet.withUse -import net.mamoe.mirai.qqandroid.network.protocol.protobuf.ProtoBuf +import net.mamoe.mirai.qqandroid.io.ProtoBuf import net.mamoe.mirai.utils.io.readIoBuffer import net.mamoe.mirai.utils.io.readString import net.mamoe.mirai.utils.io.toIoBuffer diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/PacketFactory.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/PacketFactory.kt index 019ad2ee6..b090e8a4e 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/PacketFactory.kt +++ b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/PacketFactory.kt @@ -5,11 +5,11 @@ import kotlinx.io.pool.useInstance import net.mamoe.mirai.data.Packet import net.mamoe.mirai.qqandroid.QQAndroidBot import net.mamoe.mirai.qqandroid.io.serialization.loadAs -import net.mamoe.mirai.qqandroid.network.protocol.jce.RequestPacket import net.mamoe.mirai.qqandroid.network.protocol.packet.chat.receive.MessageSvc import net.mamoe.mirai.qqandroid.network.protocol.packet.chat.receive.OnlinePush import net.mamoe.mirai.qqandroid.network.protocol.packet.login.LoginPacket import net.mamoe.mirai.qqandroid.network.protocol.packet.login.StatSvc +import net.mamoe.mirai.qqandroid.network.protocol.packet.login.data.RequestPacket import net.mamoe.mirai.utils.DefaultLogger import net.mamoe.mirai.utils.MiraiLogger import net.mamoe.mirai.utils.cryptor.adjustToPublicKey diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/data/Cmd0x352Packet.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/data/Cmd0x352Packet.kt index f08b4a137..ee6eac35f 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/data/Cmd0x352Packet.kt +++ b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/data/Cmd0x352Packet.kt @@ -2,7 +2,7 @@ package net.mamoe.mirai.qqandroid.network.protocol.packet.chat.data import kotlinx.serialization.SerialId import kotlinx.serialization.Serializable -import net.mamoe.mirai.qqandroid.network.protocol.protobuf.ProtoBuf +import net.mamoe.mirai.qqandroid.io.ProtoBuf @Serializable internal class Cmd0x352Packet( diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/data/ImageRequest.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/data/ImageRequest.kt index 4fc0c5fa1..ae1e45893 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/data/ImageRequest.kt +++ b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/data/ImageRequest.kt @@ -3,7 +3,7 @@ package net.mamoe.mirai.qqandroid.network.protocol.packet.chat.data import kotlinx.serialization.SerialId import kotlinx.serialization.Serializable import net.mamoe.mirai.qqandroid.network.protocol.packet.EMPTY_BYTE_ARRAY -import net.mamoe.mirai.qqandroid.network.protocol.protobuf.ProtoBuf +import net.mamoe.mirai.qqandroid.io.ProtoBuf import net.mamoe.mirai.utils.currentTimeSeconds interface ImgReq : ProtoBuf diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/data/MessageCommon.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/data/MessageCommon.kt deleted file mode 100644 index 5b63687fb..000000000 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/data/MessageCommon.kt +++ /dev/null @@ -1,61 +0,0 @@ -@file:Suppress("ArrayInDataClass") - -package net.mamoe.mirai.qqandroid.network.protocol.packet.chat.data - -import kotlinx.serialization.SerialId -import kotlinx.serialization.Serializable -import kotlinx.serialization.protobuf.ProtoNumberType -import kotlinx.serialization.protobuf.ProtoType -import net.mamoe.mirai.qqandroid.network.protocol.packet.EMPTY_BYTE_ARRAY -import net.mamoe.mirai.qqandroid.network.protocol.protobuf.ProtoBuf - -class MessageCommon { - - /** - * 1 -> varint - * 2 -> delimi - * 3 -> varint - * 4 -> varint - * 5 -> varint - * 6 -> varint - * 7 -> delimi - * 8 -> delimi - * 9 -> delimi - * 10 -> delimi - * 11 -> delimi - */ - @Serializable - data class PluginInfo( - @SerialId(1) val resId: Int = 0, - @SerialId(2) val packageName: String = "", - @SerialId(3) val newVer: Int = 0, - @SerialId(4) val resType: Int = 0, - @SerialId(5) val lanType: Int = 0, - @SerialId(6) val priority: Int = 0, - @SerialId(7) val resName: String = "", - @SerialId(8) val resDesc: String = "", - @SerialId(9) val resUrlBig: String = "", - @SerialId(10) val resUrlSmall: String = "", - @SerialId(11) val resConf: String = "" - ) : ProtoBuf - - @Serializable - data class AppShareInfo( - @ProtoType(ProtoNumberType.FIXED) @SerialId(1) val id: Int = 0, - @SerialId(2) val cookie: ByteArray = EMPTY_BYTE_ARRAY, - @SerialId(3) val resource: PluginInfo = PluginInfo() - ) : ProtoBuf - - @Serializable - data class ContentHead( - @SerialId(1) val pkgNum: Int = 0, - @SerialId(2) val pkgIndex: Int = 0, - @SerialId(3) val divSeq: Int = 0, - @SerialId(4) val autoReply: Int = 0 - ) : ProtoBuf - - @Serializable - data class Msg( - val s: String - ) : ProtoBuf -} \ No newline at end of file diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/data/Msg.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/data/Msg.kt index 908e70c6a..0c1d0e476 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/data/Msg.kt +++ b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/data/Msg.kt @@ -4,8 +4,8 @@ import kotlinx.serialization.SerialId import kotlinx.serialization.Serializable import kotlinx.serialization.protobuf.ProtoNumberType import kotlinx.serialization.protobuf.ProtoType +import net.mamoe.mirai.qqandroid.io.ProtoBuf import net.mamoe.mirai.qqandroid.network.protocol.packet.EMPTY_BYTE_ARRAY -import net.mamoe.mirai.qqandroid.network.protocol.protobuf.ProtoBuf @Serializable class ImCommon : ProtoBuf { @@ -318,59 +318,59 @@ class ImMsgBody : ProtoBuf { @Serializable class Elem( - @SerialId(1) val text: ImMsgBody.Text? = null, - @SerialId(2) val face: ImMsgBody.Face? = null, - @SerialId(3) val onlineImage: ImMsgBody.OnlineImage? = null, - @SerialId(4) val notOnlineImage: ImMsgBody.NotOnlineImage? = null, - @SerialId(5) val transElemInfo: ImMsgBody.TransElem? = null, - @SerialId(6) val marketFace: ImMsgBody.MarketFace? = null, - @SerialId(7) val elemFlags: ImMsgBody.ElemFlags? = null, - @SerialId(8) val customFace: ImMsgBody.CustomFace? = null, - @SerialId(9) val elemFlags2: ImMsgBody.ElemFlags2? = null, - @SerialId(10) val funFace: ImMsgBody.FunFace? = null, - @SerialId(11) val secretFile: ImMsgBody.SecretFileMsg? = null, - @SerialId(12) val richMsg: ImMsgBody.RichMsg? = null, - @SerialId(13) val groupFile: ImMsgBody.GroupFile? = null, - @SerialId(14) val pubGroup: ImMsgBody.PubGroup? = null, - @SerialId(15) val marketTrans: ImMsgBody.MarketTrans? = null, - @SerialId(16) val extraInfo: ImMsgBody.ExtraInfo? = null, - @SerialId(17) val shakeWindow: ImMsgBody.ShakeWindow? = null, - @SerialId(18) val pubAccount: ImMsgBody.PubAccount? = null, - @SerialId(19) val videoFile: ImMsgBody.VideoFile? = null, - @SerialId(20) val tipsInfo: ImMsgBody.TipsInfo? = null, - @SerialId(21) val anonGroupMsg: ImMsgBody.AnonymousGroupMsg? = null, - @SerialId(22) val qqLiveOld: ImMsgBody.QQLiveOld? = null, - @SerialId(23) val lifeOnline: ImMsgBody.LifeOnlineAccount? = null, - @SerialId(24) val qqwalletMsg: ImMsgBody.QQWalletMsg? = null, - @SerialId(25) val crmElem: ImMsgBody.CrmElem? = null, - @SerialId(26) val conferenceTipsInfo: ImMsgBody.ConferenceTipsInfo? = null, - @SerialId(27) val redbagInfo: ImMsgBody.RedBagInfo? = null, - @SerialId(28) val lowVersionTips: ImMsgBody.LowVersionTips? = null, + @SerialId(1) val text: Text? = null, + @SerialId(2) val face: Face? = null, + @SerialId(3) val onlineImage: OnlineImage? = null, + @SerialId(4) val notOnlineImage: NotOnlineImage? = null, + @SerialId(5) val transElemInfo: TransElem? = null, + @SerialId(6) val marketFace: MarketFace? = null, + @SerialId(7) val elemFlags: ElemFlags? = null, + @SerialId(8) val customFace: CustomFace? = null, + @SerialId(9) val elemFlags2: ElemFlags2? = null, + @SerialId(10) val funFace: FunFace? = null, + @SerialId(11) val secretFile: SecretFileMsg? = null, + @SerialId(12) val richMsg: RichMsg? = null, + @SerialId(13) val groupFile: GroupFile? = null, + @SerialId(14) val pubGroup: PubGroup? = null, + @SerialId(15) val marketTrans: MarketTrans? = null, + @SerialId(16) val extraInfo: ExtraInfo? = null, + @SerialId(17) val shakeWindow: ShakeWindow? = null, + @SerialId(18) val pubAccount: PubAccount? = null, + @SerialId(19) val videoFile: VideoFile? = null, + @SerialId(20) val tipsInfo: TipsInfo? = null, + @SerialId(21) val anonGroupMsg: AnonymousGroupMsg? = null, + @SerialId(22) val qqLiveOld: QQLiveOld? = null, + @SerialId(23) val lifeOnline: LifeOnlineAccount? = null, + @SerialId(24) val qqwalletMsg: QQWalletMsg? = null, + @SerialId(25) val crmElem: CrmElem? = null, + @SerialId(26) val conferenceTipsInfo: ConferenceTipsInfo? = null, + @SerialId(27) val redbagInfo: RedBagInfo? = null, + @SerialId(28) val lowVersionTips: LowVersionTips? = null, @SerialId(29) val bankcodeCtrlInfo: ByteArray = EMPTY_BYTE_ARRAY, - @SerialId(30) val nearByMsg: ImMsgBody.NearByMessageType? = null, - @SerialId(31) val customElem: ImMsgBody.CustomElem? = null, - @SerialId(32) val locationInfo: ImMsgBody.LocationInfo? = null, - @SerialId(33) val pubAccInfo: ImMsgBody.PubAccInfo? = null, - @SerialId(34) val smallEmoji: ImMsgBody.SmallEmoji? = null, - @SerialId(35) val fsjMsgElem: ImMsgBody.FSJMessageElem? = null, - @SerialId(36) val arkApp: ImMsgBody.ArkAppElem? = null, - @SerialId(37) val generalFlags: ImMsgBody.GeneralFlags? = null, - @SerialId(38) val hcFlashPic: ImMsgBody.CustomFace? = null, - @SerialId(39) val deliverGiftMsg: ImMsgBody.DeliverGiftMsg? = null, - @SerialId(40) val bitappMsg: ImMsgBody.BitAppMsg? = null, - @SerialId(41) val openQqData: ImMsgBody.OpenQQData? = null, - @SerialId(42) val apolloMsg: ImMsgBody.ApolloActMsg? = null, - @SerialId(43) val groupPubAccInfo: ImMsgBody.GroupPubAccountInfo? = null, - @SerialId(44) val blessMsg: ImMsgBody.BlessingMessage? = null, - @SerialId(45) val srcMsg: ImMsgBody.SourceMsg? = null, - @SerialId(46) val lolaMsg: ImMsgBody.LolaMsg? = null, - @SerialId(47) val groupBusinessMsg: ImMsgBody.GroupBusinessMsg? = null, - @SerialId(48) val msgWorkflowNotify: ImMsgBody.WorkflowNotifyMsg? = null, - @SerialId(49) val patElem: ImMsgBody.PatsElem? = null, - @SerialId(50) val groupPostElem: ImMsgBody.GroupPostElem? = null, - @SerialId(51) val lightApp: ImMsgBody.LightAppElem? = null, - @SerialId(52) val eimInfo: ImMsgBody.EIMInfo? = null, - @SerialId(53) val commonElem: ImMsgBody.CommonElem? = null + @SerialId(30) val nearByMsg: NearByMessageType? = null, + @SerialId(31) val customElem: CustomElem? = null, + @SerialId(32) val locationInfo: LocationInfo? = null, + @SerialId(33) val pubAccInfo: PubAccInfo? = null, + @SerialId(34) val smallEmoji: SmallEmoji? = null, + @SerialId(35) val fsjMsgElem: FSJMessageElem? = null, + @SerialId(36) val arkApp: ArkAppElem? = null, + @SerialId(37) val generalFlags: GeneralFlags? = null, + @SerialId(38) val hcFlashPic: CustomFace? = null, + @SerialId(39) val deliverGiftMsg: DeliverGiftMsg? = null, + @SerialId(40) val bitappMsg: BitAppMsg? = null, + @SerialId(41) val openQqData: OpenQQData? = null, + @SerialId(42) val apolloMsg: ApolloActMsg? = null, + @SerialId(43) val groupPubAccInfo: GroupPubAccountInfo? = null, + @SerialId(44) val blessMsg: BlessingMessage? = null, + @SerialId(45) val srcMsg: SourceMsg? = null, + @SerialId(46) val lolaMsg: LolaMsg? = null, + @SerialId(47) val groupBusinessMsg: GroupBusinessMsg? = null, + @SerialId(48) val msgWorkflowNotify: WorkflowNotifyMsg? = null, + @SerialId(49) val patElem: PatsElem? = null, + @SerialId(50) val groupPostElem: GroupPostElem? = null, + @SerialId(51) val lightApp: LightAppElem? = null, + @SerialId(52) val eimInfo: EIMInfo? = null, + @SerialId(53) val commonElem: CommonElem? = null ) : ProtoBuf @Serializable @@ -387,13 +387,13 @@ class ImMsgBody : ProtoBuf { @SerialId(4) val pttChangeBit: Int = 0, @SerialId(5) val vipStatus: Int = 0, @SerialId(6) val compatibleId: Int = 0, - @SerialId(7) val insts: List? = null, + @SerialId(7) val insts: List? = null, @SerialId(8) val msgRptCnt: Int = 0, - @SerialId(9) val srcInst: ImMsgBody.ElemFlags2.Inst? = null, + @SerialId(9) val srcInst: Inst? = null, @SerialId(10) val longtitude: Int = 0, @SerialId(11) val latitude: Int = 0, @SerialId(12) val customFont: Int = 0, - @SerialId(13) val pcSupportDef: ImMsgBody.PcSupportDef? = null, + @SerialId(13) val pcSupportDef: PcSupportDef? = null, @SerialId(14) val crmFlags: Int = 0 ) : ProtoBuf { @Serializable @@ -433,8 +433,8 @@ class ImMsgBody : ProtoBuf { @Serializable class FunFace( - @SerialId(1) val msgTurntable: ImMsgBody.FunFace.Turntable? = null, - @SerialId(2) val msgBomb: ImMsgBody.FunFace.Bomb? = null + @SerialId(1) val msgTurntable: Turntable? = null, + @SerialId(2) val msgBomb: Bomb? = null ) { @Serializable class Bomb( @@ -580,14 +580,14 @@ class ImMsgBody : ProtoBuf { @Serializable class MsgBody( - @SerialId(1) val richText: ImMsgBody.RichText? = null, + @SerialId(1) val richText: RichText = RichText(), @SerialId(2) val msgContent: ByteArray = EMPTY_BYTE_ARRAY, @SerialId(3) val msgEncryptContent: ByteArray = EMPTY_BYTE_ARRAY ) : ProtoBuf @Serializable class MsgBodySubtype4( - @SerialId(1) val msgNotOnlineFile: ImMsgBody.NotOnlineFile? = null, + @SerialId(1) val msgNotOnlineFile: NotOnlineFile? = null, @SerialId(2) val msgTime: Int = 0 ) : ProtoBuf @@ -742,8 +742,8 @@ class ImMsgBody : ProtoBuf { @Serializable class QQWalletAioBody( @SerialId(1) val senduin: Long = 0L, - @SerialId(2) val sender: ImMsgBody.QQWalletAioElem? = null, - @SerialId(3) val receiver: ImMsgBody.QQWalletAioElem? = null, + @SerialId(2) val sender: QQWalletAioElem? = null, + @SerialId(3) val receiver: QQWalletAioElem? = null, @ProtoType(ProtoNumberType.SIGNED) @SerialId(4) val sint32Channelid: Int = 0, @ProtoType(ProtoNumberType.SIGNED) @SerialId(5) val sint32Templateid: Int = 0, @SerialId(6) val resend: Int = 0, @@ -791,7 +791,7 @@ class ImMsgBody : ProtoBuf { @Serializable class QQWalletMsg( - @SerialId(1) val aioBody: ImMsgBody.QQWalletAioBody? = null + @SerialId(1) val aioBody: QQWalletAioBody? = null ) : ProtoBuf @Serializable @@ -811,12 +811,12 @@ class ImMsgBody : ProtoBuf { @Serializable class RichText( - @SerialId(1) val attr: ImMsgBody.Attr? = null, - @SerialId(2) val elems: List? = null, - @SerialId(3) val notOnlineFile: ImMsgBody.NotOnlineFile? = null, - @SerialId(4) val ptt: ImMsgBody.Ptt? = null, - @SerialId(5) val tmpPtt: ImMsgBody.TmpPtt? = null, - @SerialId(6) val trans211TmpMsg: ImMsgBody.Trans211TmpMsg? = null + @SerialId(1) val attr: Attr? = null, + @SerialId(2) val elems: MutableList = mutableListOf(), + @SerialId(3) val notOnlineFile: NotOnlineFile? = null, + @SerialId(4) val ptt: Ptt? = null, + @SerialId(5) val tmpPtt: TmpPtt? = null, + @SerialId(6) val trans211TmpMsg: Trans211TmpMsg? = null ) : ProtoBuf @Serializable @@ -832,8 +832,8 @@ class ImMsgBody : ProtoBuf { @SerialId(9) val encryptKey: ByteArray = EMPTY_BYTE_ARRAY, @SerialId(10) val readTimes: Int = 0, @SerialId(11) val leftTime: Int = 0, - @SerialId(12) val notOnlineImage: ImMsgBody.NotOnlineImage? = null, - @SerialId(13) val elemFlags2: ImMsgBody.ElemFlags2? = null, + @SerialId(12) val notOnlineImage: NotOnlineImage? = null, + @SerialId(13) val elemFlags2: ElemFlags2? = null, @SerialId(14) val opertype: Int = 0, @SerialId(15) val fromphonenum: String = "" ) : ProtoBuf @@ -857,7 +857,7 @@ class ImMsgBody : ProtoBuf { @SerialId(2) val senderUin: Long = 0L, @SerialId(3) val time: Int = 0, @SerialId(4) val flag: Int = 0, - @SerialId(5) val elems: List? = null, + @SerialId(5) val elems: List? = null, @SerialId(6) val type: Int = 0, @SerialId(7) val richMsg: ByteArray = EMPTY_BYTE_ARRAY, @SerialId(8) val pbReserve: ByteArray = EMPTY_BYTE_ARRAY, @@ -868,7 +868,7 @@ class ImMsgBody : ProtoBuf { @Serializable class Text( - @SerialId(1) val str: ByteArray = EMPTY_BYTE_ARRAY, + @SerialId(1) val str: String = "", @SerialId(2) val link: String = "", @SerialId(3) val attr6Buf: ByteArray = EMPTY_BYTE_ARRAY, @SerialId(4) val attr7Buf: ByteArray = EMPTY_BYTE_ARRAY, diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/data/MsgCommon.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/data/MsgCommon.kt index 6796214c1..e64c107a5 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/data/MsgCommon.kt +++ b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/data/MsgCommon.kt @@ -2,8 +2,8 @@ package net.mamoe.mirai.qqandroid.network.protocol.packet.chat.data import kotlinx.serialization.SerialId import kotlinx.serialization.Serializable +import net.mamoe.mirai.qqandroid.io.ProtoBuf import net.mamoe.mirai.qqandroid.network.protocol.packet.EMPTY_BYTE_ARRAY -import net.mamoe.mirai.qqandroid.network.protocol.protobuf.ProtoBuf /** * msf.msgcomm.msg_comm @@ -60,7 +60,7 @@ class MsgComm : ProtoBuf { @SerialId(1) val groupCode: Long = 0L, @SerialId(2) val groupType: Int = 0, @SerialId(3) val groupInfoSeq: Long = 0L, - @SerialId(4) val groupCard: ByteArray = EMPTY_BYTE_ARRAY, + @SerialId(4) val groupCard: String = "", @SerialId(5) val groupRank: ByteArray = EMPTY_BYTE_ARRAY, @SerialId(6) val groupLevel: Int = 0, @SerialId(7) val groupCardType: Int = 0, @@ -69,9 +69,9 @@ class MsgComm : ProtoBuf { @Serializable class Msg( - @SerialId(1) val msgHead: MsgHead? = null, + @SerialId(1) val msgHead: MsgHead, @SerialId(2) val contentHead: ContentHead? = null, - @SerialId(3) val msgBody: ImMsgBody.MsgBody? = null, + @SerialId(3) val msgBody: ImMsgBody.MsgBody, @SerialId(4) val appshareInfo: AppShareInfo? = null ) : ProtoBuf diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/data/MsgSvc.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/data/MsgSvc.kt index 981a4861e..6840ab328 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/data/MsgSvc.kt +++ b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/data/MsgSvc.kt @@ -2,8 +2,8 @@ package net.mamoe.mirai.qqandroid.network.protocol.packet.chat.data import kotlinx.serialization.SerialId import kotlinx.serialization.Serializable +import net.mamoe.mirai.qqandroid.io.ProtoBuf import net.mamoe.mirai.qqandroid.network.protocol.packet.EMPTY_BYTE_ARRAY -import net.mamoe.mirai.qqandroid.network.protocol.protobuf.ProtoBuf @Serializable class MsgSvc : ProtoBuf { @@ -31,7 +31,7 @@ class MsgSvc : ProtoBuf { @SerialId(1) val subCmd: Int = 0, @SerialId(2) val groupType: Int = 0, @SerialId(3) val groupCode: Long = 0L, - @SerialId(4) val msgList: List? = null, + @SerialId(4) val msgList: List? = null, @SerialId(5) val userdef: ByteArray = EMPTY_BYTE_ARRAY ) : ProtoBuf { @Serializable @@ -130,8 +130,8 @@ class MsgSvc : ProtoBuf { @Serializable class PbMsgWithDrawResp( - @SerialId(1) val c2cWithDraw: List? = null, - @SerialId(2) val groupWithDraw: List? = null + @SerialId(1) val c2cWithDraw: List? = null, + @SerialId(2) val groupWithDraw: List? = null ) : ProtoBuf @Serializable @@ -142,8 +142,8 @@ class MsgSvc : ProtoBuf { @Serializable class PbMsgWithDrawReq( - @SerialId(1) val c2cWithDraw: List? = null, - @SerialId(2) val groupWithDraw: List? = null + @SerialId(1) val c2cWithDraw: List? = null, + @SerialId(2) val groupWithDraw: List? = null ) : ProtoBuf @Serializable @@ -204,7 +204,7 @@ class MsgSvc : ProtoBuf { @SerialId(3) val subCmd: Int = 0, @SerialId(4) val groupType: Int = 0, @SerialId(5) val groupCode: Long = 0L, - @SerialId(6) val failedMsgList: List? = null, + @SerialId(6) val failedMsgList: List? = null, @SerialId(7) val userdef: ByteArray = EMPTY_BYTE_ARRAY ) : ProtoBuf { @Serializable @@ -230,7 +230,7 @@ class MsgSvc : ProtoBuf { @Serializable class PbC2CMsgWithDrawReq( - @SerialId(1) val msgInfo: List? = null, + @SerialId(1) val msgInfo: List? = null, @SerialId(2) val longMessageFlag: Int = 0, @SerialId(3) val reserved: ByteArray = EMPTY_BYTE_ARRAY, @SerialId(4) val subCmd: Int = 0 @@ -247,7 +247,7 @@ class MsgSvc : ProtoBuf { @SerialId(8) val pkgIndex: Int = 0, @SerialId(9) val divSeq: Int = 0, @SerialId(10) val msgType: Int = 0, - @SerialId(20) val routingHead: MsgSvc.RoutingHead? = null + @SerialId(20) val routingHead: RoutingHead? = null ) } @@ -274,7 +274,7 @@ class MsgSvc : ProtoBuf { class PbPullGroupMsgSeqResp( @SerialId(1) val result: Int = 0, @SerialId(2) val errmsg: String = "", - @SerialId(3) val groupInfoResp: List? = null + @SerialId(3) val groupInfoResp: List? = null ) : ProtoBuf { @Serializable class GroupInfoResp( @@ -286,17 +286,17 @@ class MsgSvc : ProtoBuf { @Serializable class PbSendMsgReq( - @SerialId(1) val routingHead: MsgSvc.RoutingHead? = null, + @SerialId(1) val routingHead: RoutingHead? = null, @SerialId(2) val contentHead: MsgComm.ContentHead? = null, - @SerialId(3) val msgBody: ImMsgBody.MsgBody? = null, + @SerialId(3) val msgBody: ImMsgBody.MsgBody = ImMsgBody.MsgBody(), @SerialId(4) val msgSeq: Int = 0, @SerialId(5) val msgRand: Int = 0, @SerialId(6) val syncCookie: ByteArray = EMPTY_BYTE_ARRAY, @SerialId(7) val appShare: MsgComm.AppShareInfo? = null, @SerialId(8) val msgVia: Int = 0, @SerialId(9) val dataStatist: Int = 0, - @SerialId(10) val multiMsgAssist: MsgSvc.MultiMsgAssist? = null, - @SerialId(11) val inputNotifyInfo: MsgSvc.PbInputNotifyInfo? = null, + @SerialId(10) val multiMsgAssist: MultiMsgAssist? = null, + @SerialId(11) val inputNotifyInfo: PbInputNotifyInfo? = null, @SerialId(12) val msgCtrl: MsgCtrl.MsgCtrl? = null, @SerialId(13) val receiptReq: ImReceipt.ReceiptReq? = null, @SerialId(14) val multiSendSeq: Int = 0 @@ -331,16 +331,16 @@ class MsgSvc : ProtoBuf { @Serializable class PbUnReadMsgSeqResp( - @SerialId(1) val c2cUnreadInfo: MsgSvc.PbC2CUnReadMsgNumResp? = null, - @SerialId(2) val binduinUnreadInfo: List? = null, - @SerialId(3) val groupUnreadInfo: MsgSvc.PbPullGroupMsgSeqResp? = null, - @SerialId(4) val discussUnreadInfo: MsgSvc.PbPullDiscussMsgSeqResp? = null, - @SerialId(5) val thirdqqUnreadInfo: MsgSvc.PbThirdQQUnReadMsgNumResp? = null + @SerialId(1) val c2cUnreadInfo: PbC2CUnReadMsgNumResp? = null, + @SerialId(2) val binduinUnreadInfo: List? = null, + @SerialId(3) val groupUnreadInfo: PbPullGroupMsgSeqResp? = null, + @SerialId(4) val discussUnreadInfo: PbPullDiscussMsgSeqResp? = null, + @SerialId(5) val thirdqqUnreadInfo: PbThirdQQUnReadMsgNumResp? = null ) : ProtoBuf @Serializable class PbDeleteMsgReq( - @SerialId(1) val msgItems: List? = null + @SerialId(1) val msgItems: List? = null ) : ProtoBuf { @Serializable class MsgItem( @@ -355,7 +355,7 @@ class MsgSvc : ProtoBuf { @Serializable class MultiMsgAssist( - @SerialId(1) val repeatedRouting: List? = null, + @SerialId(1) val repeatedRouting: List? = null, @SerialId(2) val msgUse: Int /* enum */ = 1, @SerialId(3) val tempId: Long = 0L, @SerialId(4) val vedioLen: Long = 0L, @@ -367,10 +367,10 @@ class MsgSvc : ProtoBuf { @Serializable class PbMsgReadedReportReq( - @SerialId(1) val grpReadReport: List? = null, - @SerialId(2) val disReadReport: List? = null, - @SerialId(3) val c2cReadReport: MsgSvc.PbC2CReadedReportReq? = null, - @SerialId(4) val bindUinReadReport: MsgSvc.PbBindUinMsgReadedConfirmReq? = null + @SerialId(1) val grpReadReport: List? = null, + @SerialId(2) val disReadReport: List? = null, + @SerialId(3) val c2cReadReport: PbC2CReadedReportReq? = null, + @SerialId(4) val bindUinReadReport: PbBindUinMsgReadedConfirmReq? = null ) : ProtoBuf @Serializable @@ -407,28 +407,28 @@ class MsgSvc : ProtoBuf { @Serializable class RoutingHead( - @SerialId(1) val c2c: MsgSvc.C2C? = null, - @SerialId(2) val grp: MsgSvc.Grp? = null, - @SerialId(3) val grpTmp: MsgSvc.GrpTmp? = null, - @SerialId(4) val dis: MsgSvc.Dis? = null, - @SerialId(5) val disTmp: MsgSvc.DisTmp? = null, - @SerialId(6) val wpaTmp: MsgSvc.WPATmp? = null, - @SerialId(7) val secretFile: MsgSvc.SecretFileHead? = null, - @SerialId(8) val publicPlat: MsgSvc.PublicPlat? = null, - @SerialId(9) val transMsg: MsgSvc.TransMsg? = null, - @SerialId(10) val addressList: MsgSvc.AddressListTmp? = null, - @SerialId(11) val richStatusTmp: MsgSvc.RichStatusTmp? = null, - @SerialId(12) val transCmd: MsgSvc.TransCmd? = null, - @SerialId(13) val accostTmp: MsgSvc.AccostTmp? = null, - @SerialId(14) val pubGroupTmp: MsgSvc.PubGroupTmp? = null, - @SerialId(15) val trans0x211: MsgSvc.Trans0x211? = null, - @SerialId(16) val businessWpaTmp: MsgSvc.BusinessWPATmp? = null, - @SerialId(17) val authTmp: MsgSvc.AuthTmp? = null, - @SerialId(18) val bsnsTmp: MsgSvc.BsnsTmp? = null, - @SerialId(19) val qqQuerybusinessTmp: MsgSvc.QQQueryBusinessTmp? = null, - @SerialId(20) val nearbyDatingTmp: MsgSvc.NearByDatingTmp? = null, - @SerialId(21) val nearbyAssistantTmp: MsgSvc.NearByAssistantTmp? = null, - @SerialId(22) val commTmp: MsgSvc.CommTmp? = null + @SerialId(1) val c2c: C2C? = null, + @SerialId(2) val grp: Grp? = null, + @SerialId(3) val grpTmp: GrpTmp? = null, + @SerialId(4) val dis: Dis? = null, + @SerialId(5) val disTmp: DisTmp? = null, + @SerialId(6) val wpaTmp: WPATmp? = null, + @SerialId(7) val secretFile: SecretFileHead? = null, + @SerialId(8) val publicPlat: PublicPlat? = null, + @SerialId(9) val transMsg: TransMsg? = null, + @SerialId(10) val addressList: AddressListTmp? = null, + @SerialId(11) val richStatusTmp: RichStatusTmp? = null, + @SerialId(12) val transCmd: TransCmd? = null, + @SerialId(13) val accostTmp: AccostTmp? = null, + @SerialId(14) val pubGroupTmp: PubGroupTmp? = null, + @SerialId(15) val trans0x211: Trans0x211? = null, + @SerialId(16) val businessWpaTmp: BusinessWPATmp? = null, + @SerialId(17) val authTmp: AuthTmp? = null, + @SerialId(18) val bsnsTmp: BsnsTmp? = null, + @SerialId(19) val qqQuerybusinessTmp: QQQueryBusinessTmp? = null, + @SerialId(20) val nearbyDatingTmp: NearByDatingTmp? = null, + @SerialId(21) val nearbyAssistantTmp: NearByAssistantTmp? = null, + @SerialId(22) val commTmp: CommTmp? = null ) : ProtoBuf @Serializable @@ -445,9 +445,9 @@ class MsgSvc : ProtoBuf { @SerialId(2) val errmsg: String = "", @SerialId(3) val sendTime: Int = 0, @SerialId(4) val svrbusyWaitTime: Int = 0, - @SerialId(5) val msgSendInfo: MsgSvc.MsgSendInfo? = null, + @SerialId(5) val msgSendInfo: MsgSendInfo? = null, @SerialId(6) val errtype: Int = 0, - @SerialId(7) val transSvrInfo: MsgSvc.TransSvrInfo? = null, + @SerialId(7) val transSvrInfo: TransSvrInfo? = null, @SerialId(8) val receiptResp: ImReceipt.ReceiptResp? = null, @SerialId(9) val textAnalysisResult: Int = 0 ) : ProtoBuf @@ -475,12 +475,12 @@ class MsgSvc : ProtoBuf { class PbC2CMsgWithDrawResp( @SerialId(1) val result: Int = 0, @SerialId(2) val errmsg: String = "", - @SerialId(3) val msgStatus: List? = null, + @SerialId(3) val msgStatus: List? = null, @SerialId(4) val subCmd: Int = 0 ) : ProtoBuf { @Serializable class MsgStatus( - @SerialId(1) val msgInfo: MsgSvc.PbC2CMsgWithDrawReq.MsgInfo? = null, + @SerialId(1) val msgInfo: PbC2CMsgWithDrawReq.MsgInfo? = null, @SerialId(2) val status: Int = 0 ) : ProtoBuf } @@ -513,17 +513,17 @@ class MsgSvc : ProtoBuf { @Serializable class PbMsgReadedReportResp( - @SerialId(1) val grpReadReport: List? = null, - @SerialId(2) val disReadReport: List? = null, - @SerialId(3) val c2cReadReport: MsgSvc.PbC2CReadedReportResp? = null, - @SerialId(4) val bindUinReadReport: MsgSvc.PbBindUinMsgReadedConfirmResp? = null + @SerialId(1) val grpReadReport: List? = null, + @SerialId(2) val disReadReport: List? = null, + @SerialId(3) val c2cReadReport: PbC2CReadedReportResp? = null, + @SerialId(4) val bindUinReadReport: PbBindUinMsgReadedConfirmResp? = null ) : ProtoBuf @Serializable class PbThirdQQUnReadMsgNumResp( @SerialId(1) val result: Int = 0, @SerialId(2) val errmsg: String = "", - @SerialId(3) val thirdqqRespInfo: List? = null, + @SerialId(3) val thirdqqRespInfo: List? = null, @SerialId(4) val interval: Int = 0 ) : ProtoBuf { @Serializable @@ -552,9 +552,9 @@ class MsgSvc : ProtoBuf { @Serializable class PbDelRoamMsgReq( - @SerialId(1) val c2cMsg: MsgSvc.PbDelRoamMsgReq.C2CMsg? = null, - @SerialId(2) val grpMsg: MsgSvc.PbDelRoamMsgReq.GrpMsg? = null, - @SerialId(3) val disMsg: MsgSvc.PbDelRoamMsgReq.DisMsg? = null + @SerialId(1) val c2cMsg: C2CMsg? = null, + @SerialId(2) val grpMsg: GrpMsg? = null, + @SerialId(3) val disMsg: DisMsg? = null ) : ProtoBuf { @Serializable class GrpMsg( @@ -580,18 +580,18 @@ class MsgSvc : ProtoBuf { @Serializable class PbUnReadMsgSeqReq( - @SerialId(1) val c2cUnreadInfo: MsgSvc.PbC2CUnReadMsgNumReq? = null, - @SerialId(2) val binduinUnreadInfo: List? = null, - @SerialId(3) val groupUnreadInfo: MsgSvc.PbPullGroupMsgSeqReq? = null, - @SerialId(4) val discussUnreadInfo: MsgSvc.PbPullDiscussMsgSeqReq? = null, - @SerialId(5) val thirdqqUnreadInfo: MsgSvc.PbThirdQQUnReadMsgNumReq? = null + @SerialId(1) val c2cUnreadInfo: PbC2CUnReadMsgNumReq? = null, + @SerialId(2) val binduinUnreadInfo: List? = null, + @SerialId(3) val groupUnreadInfo: PbPullGroupMsgSeqReq? = null, + @SerialId(4) val discussUnreadInfo: PbPullDiscussMsgSeqReq? = null, + @SerialId(5) val thirdqqUnreadInfo: PbThirdQQUnReadMsgNumReq? = null ) : ProtoBuf @Serializable class PbPullDiscussMsgSeqResp( @SerialId(1) val result: Int = 0, @SerialId(2) val errmsg: String = "", - @SerialId(3) val discussInfoResp: List? = null + @SerialId(3) val discussInfoResp: List? = null ) : ProtoBuf { @Serializable class DiscussInfoResp( @@ -603,7 +603,7 @@ class MsgSvc : ProtoBuf { @Serializable class PbPullDiscussMsgSeqReq( - @SerialId(1) val discussInfoReq: List? = null + @SerialId(1) val discussInfoReq: List? = null ) : ProtoBuf { @Serializable class DiscussInfoReq( @@ -652,7 +652,7 @@ class MsgSvc : ProtoBuf { @Serializable class PbC2CReadedReportReq( @SerialId(1) val syncCookie: ByteArray = EMPTY_BYTE_ARRAY, - @SerialId(2) val pairInfo: List? = null + @SerialId(2) val pairInfo: List? = null ) : ProtoBuf { @Serializable class UinPairReadInfo( @@ -692,7 +692,7 @@ class MsgSvc : ProtoBuf { @Serializable class PbPullGroupMsgSeqReq( - @SerialId(1) val groupInfoReq: List? = null + @SerialId(1) val groupInfoReq: List? = null ) : ProtoBuf { @Serializable class GroupInfoReq( @@ -729,7 +729,7 @@ class MsgSvc : ProtoBuf { @Serializable class PbThirdQQUnReadMsgNumReq( - @SerialId(1) val thirdqqReqInfo: List? = null, + @SerialId(1) val thirdqqReqInfo: List? = null, @SerialId(2) val source: Int = 0 ) : ProtoBuf { @Serializable @@ -794,7 +794,7 @@ class SubMsgType0xc1 { @SerialId(9) val encryptKey: ByteArray = EMPTY_BYTE_ARRAY, @SerialId(10) val readTimes: Int = 0, @SerialId(11) val leftTime: Int = 0, - @SerialId(12) val notOnlineImage: SubMsgType0xc1.NotOnlineImage? = null + @SerialId(12) val notOnlineImage: NotOnlineImage? = null ) : ProtoBuf } diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/data/OnlinePush.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/data/OnlinePush.kt index a77adcb31..808096850 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/data/OnlinePush.kt +++ b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/data/OnlinePush.kt @@ -2,14 +2,14 @@ package net.mamoe.mirai.qqandroid.network.protocol.packet.chat.data import kotlinx.serialization.SerialId import kotlinx.serialization.Serializable +import net.mamoe.mirai.qqandroid.io.ProtoBuf import net.mamoe.mirai.qqandroid.network.protocol.packet.EMPTY_BYTE_ARRAY -import net.mamoe.mirai.qqandroid.network.protocol.protobuf.ProtoBuf @Serializable class MsgOnlinePush { @Serializable - data class PbPushMsg( - @SerialId(1) val msg: MsgComm.Msg? = null, + class PbPushMsg( + @SerialId(1) val msg: MsgComm.Msg, @SerialId(2) val svrip: Int = 0, @SerialId(3) val pushToken: ByteArray = EMPTY_BYTE_ARRAY, @SerialId(4) val pingFlag: Int = 0, diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/image/GroupImageRequest.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/image/GroupImageRequest.kt deleted file mode 100644 index c7a18d722..000000000 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/image/GroupImageRequest.kt +++ /dev/null @@ -1,2 +0,0 @@ -package net.mamoe.mirai.qqandroid.network.protocol.packet.chat.image - diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/receive/MessageSvc.PushNotify.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/receive/MessageSvc.PushNotify.kt index 303bc298f..2d36a8acf 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/receive/MessageSvc.PushNotify.kt +++ b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/receive/MessageSvc.PushNotify.kt @@ -2,19 +2,15 @@ package net.mamoe.mirai.qqandroid.network.protocol.packet.chat.receive import kotlinx.io.core.ByteReadPacket import kotlinx.io.core.discardExact -import kotlinx.serialization.SerialId -import kotlinx.serialization.Serializable import net.mamoe.mirai.qqandroid.QQAndroidBot -import net.mamoe.mirai.qqandroid.io.JceStruct import net.mamoe.mirai.qqandroid.io.serialization.loadAs import net.mamoe.mirai.qqandroid.io.serialization.readRemainingAsJceStruct -import net.mamoe.mirai.qqandroid.network.protocol.jce.RequestDataVersion2 -import net.mamoe.mirai.qqandroid.network.protocol.jce.RequestPacket +import net.mamoe.mirai.qqandroid.network.protocol.packet.login.data.RequestDataVersion2 +import net.mamoe.mirai.qqandroid.network.protocol.packet.login.data.RequestPacket import net.mamoe.mirai.qqandroid.network.protocol.packet.PacketFactory import net.mamoe.mirai.qqandroid.network.protocol.packet.chat.data.RequestPushNotify import net.mamoe.mirai.utils.cryptor.contentToString import net.mamoe.mirai.utils.firstValue -import net.mamoe.mirai.utils.io.debugPrint import net.mamoe.mirai.utils.io.toReadPacket class MessageSvc { diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/receive/OnlinePush.PbPushGroupMsg.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/receive/OnlinePush.PbPushGroupMsg.kt index 203338c54..ea708a8a1 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/receive/OnlinePush.PbPushGroupMsg.kt +++ b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/receive/OnlinePush.PbPushGroupMsg.kt @@ -17,7 +17,6 @@ import net.mamoe.mirai.qqandroid.QQAndroidBot import net.mamoe.mirai.qqandroid.network.protocol.packet.PacketFactory import net.mamoe.mirai.qqandroid.network.protocol.packet.chat.data.ImMsgBody import net.mamoe.mirai.qqandroid.network.protocol.packet.chat.data.MsgOnlinePush -import net.mamoe.mirai.utils.io.encodeToString internal class ImageIdQQA( override val value: String, @@ -35,25 +34,25 @@ internal class OnlinePush { // 00 00 02 E4 0A D5 05 0A 4F 08 A2 FF 8C F0 03 10 DD F1 92 B7 07 18 52 20 00 28 BC 3D 30 8C 82 AB F1 05 38 D2 80 E0 8C 80 80 80 80 02 4A 21 08 E7 C1 AD B8 02 10 01 18 BA 05 22 09 48 69 6D 31 38 38 6D 6F 65 30 06 38 02 42 05 4D 69 72 61 69 50 01 58 01 60 00 88 01 08 12 06 08 01 10 00 18 00 1A F9 04 0A F6 04 0A 26 08 00 10 87 82 AB F1 05 18 B7 B4 BF 30 20 00 28 0C 30 00 38 86 01 40 22 4A 0C E5 BE AE E8 BD AF E9 9B 85 E9 BB 91 12 E6 03 42 E3 03 12 2A 7B 34 45 31 38 35 38 32 32 2D 30 45 37 42 2D 46 38 30 46 2D 43 35 42 31 2D 33 34 34 38 38 33 37 34 44 33 39 43 7D 2E 6A 70 67 22 00 2A 04 03 00 00 00 32 60 15 36 20 39 36 6B 45 31 41 38 35 32 32 39 64 63 36 39 38 34 37 39 37 37 62 20 20 20 20 20 20 35 30 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7B 34 45 31 38 35 38 32 32 2D 30 45 37 42 2D 46 38 30 46 2D 43 35 42 31 2D 33 34 34 38 38 33 37 34 44 33 39 43 7D 2E 6A 70 67 31 32 31 32 41 38 C6 BB 8A A9 08 40 FB AE 9E C2 09 48 50 50 41 5A 00 60 01 6A 10 4E 18 58 22 0E 7B F8 0F C5 B1 34 48 83 74 D3 9C 72 59 2F 67 63 68 61 74 70 69 63 5F 6E 65 77 2F 31 30 34 30 34 30 30 32 39 30 2F 36 35 35 30 35 37 31 32 37 2D 32 32 33 33 36 33 38 33 34 32 2D 34 45 31 38 35 38 32 32 30 45 37 42 46 38 30 46 43 35 42 31 33 34 34 38 38 33 37 34 44 33 39 43 2F 31 39 38 3F 74 65 72 6D 3D 32 82 01 57 2F 67 63 68 61 74 70 69 63 5F 6E 65 77 2F 31 30 34 30 34 30 30 32 39 30 2F 36 35 35 30 35 37 31 32 37 2D 32 32 33 33 36 33 38 33 34 32 2D 34 45 31 38 35 38 32 32 30 45 37 42 46 38 30 46 43 35 42 31 33 34 34 38 38 33 37 34 44 33 39 43 2F 30 3F 74 65 72 6D 3D 32 B0 01 4D B8 01 2E C8 01 FF 05 D8 01 4D E0 01 2E FA 01 59 2F 67 63 68 61 74 70 69 63 5F 6E 65 77 2F 31 30 34 30 34 30 30 32 39 30 2F 36 35 35 30 35 37 31 32 37 2D 32 32 33 33 36 33 38 33 34 32 2D 34 45 31 38 35 38 32 32 30 45 37 42 46 38 30 46 43 35 42 31 33 34 34 38 38 33 37 34 44 33 39 43 2F 34 30 30 3F 74 65 72 6D 3D 32 80 02 4D 88 02 2E 12 45 AA 02 42 50 03 60 00 68 00 9A 01 39 08 09 20 BF 50 80 01 01 C8 01 00 F0 01 00 F8 01 00 90 02 00 98 03 00 A0 03 20 B0 03 00 C0 03 00 D0 03 00 E8 03 00 8A 04 04 08 02 08 01 90 04 80 80 80 10 B8 04 00 C0 04 00 12 06 4A 04 08 00 40 01 12 14 82 01 11 0A 09 48 69 6D 31 38 38 6D 6F 65 18 06 20 08 28 03 10 8A CA 9D A1 07 1A 00 discardExact(4) val pbPushMsg = ProtoBuf.load(MsgOnlinePush.PbPushMsg.serializer(), readBytes()) - val message = MessageChain(initialCapacity = pbPushMsg.msg!!.msgBody!!.richText!!.elems!!.size) + val message = MessageChain(initialCapacity = pbPushMsg.msg.msgBody.richText.elems.size) var extraInfo: ImMsgBody.ExtraInfo? = null - pbPushMsg.msg.msgBody!!.richText!!.elems!!.forEach { + pbPushMsg.msg.msgBody.richText.elems.forEach { when { it.customFace != null -> message.add(Image(ImageIdQQA(it.customFace.filePath, it.customFace.origUrl))) - it.text != null -> message.add(it.text.str.encodeToString().toMessage()) + it.text != null -> message.add(it.text.str.toMessage()) it.extraInfo != null -> extraInfo = it.extraInfo } } - val group = bot.getGroup(pbPushMsg.msg.msgHead!!.groupInfo!!.groupCode) + val group = bot.getGroup(pbPushMsg.msg.msgHead.groupInfo!!.groupCode) val flags = extraInfo?.flags ?: 0 return GroupMessage( bot = bot, group = group, - senderName = pbPushMsg.msg.msgHead.groupInfo!!.groupCard.encodeToString(), + senderName = pbPushMsg.msg.msgHead.groupInfo.groupCard, sender = group.getMember(pbPushMsg.msg.msgHead.fromUin), message = message, permission = when { diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/send/PbSendMsg.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/send/PbSendMsg.kt new file mode 100644 index 000000000..83564b6a8 --- /dev/null +++ b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/send/PbSendMsg.kt @@ -0,0 +1,27 @@ +package net.mamoe.mirai.qqandroid.network.protocol.packet.chat.send + +import net.mamoe.mirai.message.data.At +import net.mamoe.mirai.message.data.Image +import net.mamoe.mirai.message.data.MessageChain +import net.mamoe.mirai.message.data.PlainText +import net.mamoe.mirai.qqandroid.network.protocol.packet.chat.data.ImMsgBody +import net.mamoe.mirai.qqandroid.network.protocol.packet.chat.data.MsgSvc + + +internal fun MessageChain.constructPbSendMsgReq(): MsgSvc.PbSendMsgReq { + val request = MsgSvc.PbSendMsgReq() + + this.forEach { + when (it) { + is PlainText -> { + request.msgBody.richText.elems.add(ImMsgBody.Elem(text = ImMsgBody.Text(str = it.stringValue))) + } + is At -> { + + } + } + } + + + return request +} \ No newline at end of file diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/login/LoginPacket.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/login/LoginPacket.kt index a6d8b71dd..0f3e4f45d 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/login/LoginPacket.kt +++ b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/login/LoginPacket.kt @@ -22,11 +22,10 @@ import net.mamoe.mirai.utils.io.discardExact */ @UseExperimental(ExperimentalUnsignedTypes::class) internal object LoginPacket : PacketFactory("wtlogin.login") { + private const val appId = 16L + private const val subAppId = 537062845L object SubCommand2 { - private const val appId = 16L - private const val subAppId = 537062845L - @UseExperimental(MiraiInternalAPI::class) operator fun invoke( client: QQAndroidClient, @@ -47,9 +46,6 @@ internal object LoginPacket : PacketFactory("wt } object SubCommand7 { - private const val appId = 16L - private const val subAppId = 537062845L - @UseExperimental(MiraiInternalAPI::class) operator fun invoke( client: QQAndroidClient, @@ -74,9 +70,6 @@ internal object LoginPacket : PacketFactory("wt } object SubCommand9 { - private const val appId = 16L - private const val subAppId = 537062845L - @UseExperimental(MiraiInternalAPI::class) operator fun invoke( client: QQAndroidClient diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/login/Register.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/login/Register.kt index 7ac9839b5..dee67c23f 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/login/Register.kt +++ b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/login/Register.kt @@ -7,10 +7,10 @@ import net.mamoe.mirai.qqandroid.QQAndroidBot import net.mamoe.mirai.qqandroid.io.serialization.toByteArray import net.mamoe.mirai.qqandroid.io.serialization.writeJceStruct import net.mamoe.mirai.qqandroid.network.QQAndroidClient -import net.mamoe.mirai.qqandroid.network.protocol.jce.RequestDataStructSvcReqRegister -import net.mamoe.mirai.qqandroid.network.protocol.jce.RequestDataVersion3 -import net.mamoe.mirai.qqandroid.network.protocol.jce.RequestPacket -import net.mamoe.mirai.qqandroid.network.protocol.jce.SvcReqRegister +import net.mamoe.mirai.qqandroid.network.protocol.packet.login.data.RequestDataStructSvcReqRegister +import net.mamoe.mirai.qqandroid.network.protocol.packet.login.data.RequestDataVersion3 +import net.mamoe.mirai.qqandroid.network.protocol.packet.login.data.RequestPacket +import net.mamoe.mirai.qqandroid.network.protocol.packet.login.data.SvcReqRegister import net.mamoe.mirai.qqandroid.network.protocol.packet.OutgoingPacket import net.mamoe.mirai.qqandroid.network.protocol.packet.PacketFactory import net.mamoe.mirai.qqandroid.network.protocol.packet.buildLoginOutgoingPacket diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/jce/RequestPacket.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/login/data/RequestPacket.kt similarity index 88% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/jce/RequestPacket.kt rename to mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/login/data/RequestPacket.kt index 562c2b7c4..b53730888 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/jce/RequestPacket.kt +++ b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/login/data/RequestPacket.kt @@ -1,9 +1,7 @@ -package net.mamoe.mirai.qqandroid.network.protocol.jce +package net.mamoe.mirai.qqandroid.network.protocol.packet.login.data -import kotlinx.serialization.Polymorphic import kotlinx.serialization.SerialId import kotlinx.serialization.Serializable -import kotlinx.serialization.UseSerializers import net.mamoe.mirai.qqandroid.io.JceStruct import net.mamoe.mirai.qqandroid.network.protocol.packet.EMPTY_BYTE_ARRAY diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/jce/SvcReqRegister.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/login/data/SvcReqRegister.kt similarity index 96% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/jce/SvcReqRegister.kt rename to mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/login/data/SvcReqRegister.kt index 013f7e0b3..34cf297e9 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/jce/SvcReqRegister.kt +++ b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/login/data/SvcReqRegister.kt @@ -1,4 +1,4 @@ -package net.mamoe.mirai.qqandroid.network.protocol.jce +package net.mamoe.mirai.qqandroid.network.protocol.packet.login.data import kotlinx.serialization.Polymorphic import kotlinx.serialization.SerialId diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/oidb/oidb0x769/Oidb0x769.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/oidb/oidb0x769/Oidb0x769.kt index 5f82bd34d..89934259c 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/oidb/oidb0x769/Oidb0x769.kt +++ b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/oidb/oidb0x769/Oidb0x769.kt @@ -2,7 +2,7 @@ package net.mamoe.mirai.qqandroid.network.protocol.packet.oidb.oidb0x769 import kotlinx.serialization.SerialId import kotlinx.serialization.Serializable -import net.mamoe.mirai.qqandroid.network.protocol.protobuf.ProtoBuf +import net.mamoe.mirai.qqandroid.io.ProtoBuf class Oidb0x769 { @Serializable diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/protobuf/ProtoBuf.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/protobuf/ProtoBuf.kt deleted file mode 100644 index bb876aa6e..000000000 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/protobuf/ProtoBuf.kt +++ /dev/null @@ -1,7 +0,0 @@ -package net.mamoe.mirai.qqandroid.network.protocol.protobuf - -/** - * 仅有标示作用 - */ -interface ProtoBuf { -} \ No newline at end of file