mirror of
https://github.com/mamoe/mirai.git
synced 2025-03-10 20:20:08 +08:00
Android Protocol - Rebuild Image Protocol
This commit is contained in:
parent
5d9dff59ac
commit
4c08503952
@ -1,9 +1,13 @@
|
||||
package net.mamoe.mirai.qqandroid.network.protocol.packet.chat.image
|
||||
|
||||
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.network.protocol.packet.OutgoingPacket
|
||||
import net.mamoe.mirai.qqandroid.network.protocol.packet.PacketFactory
|
||||
import net.mamoe.mirai.qqandroid.network.protocol.packet.buildOutgingPacket
|
||||
|
||||
internal object ImageDownPacket : PacketFactory<ImageDownPacket.ImageDownPacketResponse>() {
|
||||
|
||||
@ -12,6 +16,15 @@ internal object ImageDownPacket : PacketFactory<ImageDownPacket.ImageDownPacketR
|
||||
}
|
||||
|
||||
|
||||
operator fun invoke(client: QQAndroidClient, req: GetImgUrlReq): OutgoingPacket {
|
||||
return buildOutgingPacket(client, this._commandName, this._commandName, client.wLoginSigInfo.d2Key) {
|
||||
ProtoBuf.dump(
|
||||
Cmd0x325Packet.serializer(),
|
||||
Cmd0x325Packet.createByImageRequest(req)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun ByteReadPacket.decode(bot: QQAndroidBot): ImageDownPacketResponse {
|
||||
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
|
@ -1,9 +1,13 @@
|
||||
package net.mamoe.mirai.qqandroid.network.protocol.packet.chat.image
|
||||
|
||||
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.network.protocol.packet.OutgoingPacket
|
||||
import net.mamoe.mirai.qqandroid.network.protocol.packet.PacketFactory
|
||||
import net.mamoe.mirai.qqandroid.network.protocol.packet.buildOutgingPacket
|
||||
|
||||
internal object ImageUpPacket : PacketFactory<ImageUpPacket.ImageUpPacketResponse>() {
|
||||
|
||||
@ -12,6 +16,15 @@ internal object ImageUpPacket : PacketFactory<ImageUpPacket.ImageUpPacketRespons
|
||||
}
|
||||
|
||||
|
||||
operator fun invoke(client: QQAndroidClient, req: UploadImgReq): OutgoingPacket {
|
||||
return buildOutgingPacket(client, this._commandName, this._commandName, client.wLoginSigInfo.d2Key) {
|
||||
ProtoBuf.dump(
|
||||
Cmd0x325Packet.serializer(),
|
||||
Cmd0x325Packet.createByImageRequest(req)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun ByteReadPacket.decode(bot: QQAndroidBot): ImageUpPacketResponse {
|
||||
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
@ -21,5 +34,4 @@ internal object ImageUpPacket : PacketFactory<ImageUpPacket.ImageUpPacketRespons
|
||||
object Success : ImageUpPacketResponse()
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user