Commit 24d65666 authored by jiahua.liu's avatar jiahua.liu

:ProtoBuf

parent 2f4a4a48
......@@ -2,6 +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
@Serializable
internal class Cmd0x352Packet(
......@@ -10,7 +11,7 @@ internal class Cmd0x352Packet(
@SerialId(3) val getImgUrlReq: GetImgUrlReq? = null,// optional
@SerialId(4) val deleteImgReq: String? = "",// optional (没有做也不准备做, 没用)
@SerialId(10) val networkType: Int = 5// 数据网络=5
) {
) : ProtoBuf {
companion object {
fun createByImageRequest(req: ImgReq, networkType: Int = 5): Cmd0x352Packet {
if (req is UploadImgReq)
......@@ -32,5 +33,4 @@ internal class Cmd0x352Packet(
error("Unknown ImgReq")
}
}
}
\ No newline at end of file
......@@ -3,9 +3,10 @@ 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.utils.currentTimeSeconds
interface ImgReq
interface ImgReq : ProtoBuf
@Serializable
internal class UploadImgReq(
......
......@@ -7,6 +7,7 @@ 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 {
......@@ -36,25 +37,25 @@ class MessageCommon {
@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,
@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(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
......@@ -3,18 +3,19 @@ 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
/**
* msf.msgcomm.msg_comm
*/
@Serializable
class MsgComm {
class MsgComm : ProtoBuf {
@Serializable
class AppShareInfo(
@SerialId(1) val appshareId: Int = 0,
@SerialId(2) val appshareCookie: ByteArray = EMPTY_BYTE_ARRAY,
@SerialId(3) val appshareResource: PluginInfo? = null
)
) : ProtoBuf
@Serializable
class C2CTmpMsgHead(
......@@ -29,7 +30,7 @@ class MsgComm {
@SerialId(9) val lockDisplay: Int = 0,
@SerialId(10) val directionFlag: Int = 0,
@SerialId(11) val reserved: ByteArray = EMPTY_BYTE_ARRAY
)
) : ProtoBuf
@Serializable
class ContentHead(
......@@ -37,7 +38,7 @@ class MsgComm {
@SerialId(2) val pkgIndex: Int = 0,
@SerialId(3) val divSeq: Int = 0,
@SerialId(4) val autoReply: Int = 0
)
) : ProtoBuf
@Serializable
class DiscussInfo(
......@@ -46,13 +47,13 @@ class MsgComm {
@SerialId(3) val discussInfoSeq: Long = 0L,
@SerialId(4) val discussRemark: ByteArray = EMPTY_BYTE_ARRAY,
@SerialId(5) val discussName: ByteArray = EMPTY_BYTE_ARRAY
)
) : ProtoBuf
@Serializable
class ExtGroupKeyInfo(
@SerialId(1) val curMaxSeq: Int = 0,
@SerialId(2) val curTime: Long = 0L
)
) : ProtoBuf
@Serializable
class GroupInfo(
......@@ -64,7 +65,7 @@ class MsgComm {
@SerialId(6) val groupLevel: Int = 0,
@SerialId(7) val groupCardType: Int = 0,
@SerialId(8) val groupName: ByteArray = EMPTY_BYTE_ARRAY
)
) : ProtoBuf
@Serializable
class Msg(
......@@ -72,7 +73,7 @@ class MsgComm {
@SerialId(2) val contentHead: ContentHead? = null,
@SerialId(3) val msgBody: ImMsgBody.MsgBody? = null,
@SerialId(4) val appshareInfo: AppShareInfo? = null
)
) : ProtoBuf
@Serializable
class MsgHead(
......@@ -104,19 +105,19 @@ class MsgComm {
@SerialId(26) val multiCompatibleText: String = "",
@SerialId(27) val authSex: Int = 0,
@SerialId(28) val isSrcMsg: Boolean = false
)
) : ProtoBuf
@Serializable
class MsgType0x210(
@SerialId(1) val subMsgType: Int = 0,
@SerialId(2) val msgContent: ByteArray = EMPTY_BYTE_ARRAY
)
) : ProtoBuf
@Serializable
class MutilTransHead(
@SerialId(1) val status: Int = 0,
@SerialId(2) val msgId: Int = 0
)
) : ProtoBuf
@Serializable
class PluginInfo(
......@@ -131,13 +132,13 @@ class MsgComm {
@SerialId(9) val resUrlBig: String = "",
@SerialId(10) val resUrlSmall: String = "",
@SerialId(11) val resConf: String = ""
)
) : ProtoBuf
@Serializable
class Uin2Nick(
@SerialId(1) val uin: Long = 0L,
@SerialId(2) val nick: String = ""
)
) : ProtoBuf
@Serializable
class UinPairMsg(
......@@ -149,5 +150,5 @@ class MsgComm {
@SerialId(8) val c2cType: Int = 0,
@SerialId(9) val serviceType: Int = 0,
@SerialId(10) val pbReserve: ByteArray = EMPTY_BYTE_ARRAY
)
) : ProtoBuf
}
\ No newline at end of file
......@@ -3,6 +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
@Serializable
class MsgOnlinePush {
......@@ -13,5 +14,5 @@ class MsgOnlinePush {
@SerialId(3) val pushToken: ByteArray = EMPTY_BYTE_ARRAY,
@SerialId(4) val pingFlag: Int = 0,
@SerialId(9) val generalFlag: Int = 0
)
) : ProtoBuf
}
\ No newline at end of file
......@@ -2,6 +2,7 @@ package net.mamoe.mirai.qqandroid.network.protocol.packet.chat.receive
import kotlinx.io.core.ByteReadPacket
import kotlinx.io.core.discardExact
import kotlinx.serialization.protobuf.ProtoBuf
import net.mamoe.mirai.qqandroid.QQAndroidBot
import net.mamoe.mirai.qqandroid.io.serialization.Jce
import net.mamoe.mirai.qqandroid.network.protocol.jce.RequestPacket
......@@ -22,7 +23,9 @@ class MessageSvc {
req.sBuffer[0]!!
)
println(messageNotification.contentToString())
ProtoBuf
TODO()
}
}
}
\ No newline at end of file
}
package net.mamoe.mirai.qqandroid.network.protocol.packet.friend
import kotlinx.io.core.ByteReadPacket
import net.mamoe.mirai.data.Packet
import net.mamoe.mirai.qqandroid.QQAndroidBot
import net.mamoe.mirai.qqandroid.network.protocol.packet.PacketFactory
internal object GetFriendListRequest :
PacketFactory<GetFriendListRequest.GetFriendListResponse>("friendlist.GetFriendListReq") {
class GetFriendListResponse() : Packet
override suspend fun ByteReadPacket.decode(bot: QQAndroidBot): GetFriendListResponse {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
package net.mamoe.mirai.qqandroid.network.protocol.packet.friend.data
import kotlinx.serialization.Serializable
@Serializable
class Vec0xd6bReq {
}
\ No newline at end of file
......@@ -4,9 +4,10 @@ import kotlinx.io.core.ByteReadPacket
import kotlinx.serialization.protobuf.ProtoBuf
import net.mamoe.mirai.data.Packet
import net.mamoe.mirai.qqandroid.QQAndroidBot
import net.mamoe.mirai.qqandroid.network.QQAndroidClient
import net.mamoe.mirai.qqandroid.io.JceInput
import net.mamoe.mirai.qqandroid.io.jceMap
import net.mamoe.mirai.qqandroid.io.jceStruct
import net.mamoe.mirai.qqandroid.network.QQAndroidClient
import net.mamoe.mirai.qqandroid.network.protocol.jce.SvcReqRegister
import net.mamoe.mirai.qqandroid.network.protocol.jce.writeUniRequestPacket
import net.mamoe.mirai.qqandroid.network.protocol.packet.OutgoingPacket
......@@ -55,6 +56,7 @@ class StatSvc {
client, subAppId = subAppId, commandName = commandName,
extraData = client.wLoginSigInfo.tgt.toReadPacket(), sequenceId = sequenceId
) {
JceInput
writeUniRequestPacket {
sServantName = "PushService"
sFuncName = "SvcReqRegister"
......
package net.mamoe.mirai.qqandroid.network.protocol.protobuf
/**
* 仅有标示作用
*/
interface ProtoBuf {
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment