From a062ff9ed3eb56df44896270462d55c0ba5295d3 Mon Sep 17 00:00:00 2001 From: sandtechnology Date: Tue, 18 Aug 2020 02:25:21 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81=E8=A7=A3=E6=9E=90=E5=A5=BD?= =?UTF-8?q?=E5=8F=8B=E8=BE=93=E5=85=A5=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../network/protocol/data/proto/msgType0x210.kt | 3 +-- .../packet/chat/receive/OnlinePush.ReqPush.kt | 15 +++++++++++---- .../kotlin/net.mamoe.mirai/event/events/friend.kt | 8 ++++++++ 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/msgType0x210.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/msgType0x210.kt index 5d3da651c..1e4c2cc83 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/msgType0x210.kt +++ b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/msgType0x210.kt @@ -182,7 +182,7 @@ internal class Submsgtype0x115 { @Serializable internal class NotifyItem( @ProtoId(1) @JvmField val ime: Int = 0, - @ProtoId(2) @JvmField val timeoutS: Int = 0, + @ProtoId(2) @JvmField val timeout: Int = 0, @ProtoId(3) @JvmField val timestamp: Long = 0L, @ProtoId(4) @JvmField val eventType: Int = 0, @ProtoId(5) @JvmField val interval: Int = 0, @@ -611,7 +611,6 @@ internal class Submsgtype0x26 { } } - internal class Submsgtype0x27 { internal class SubMsgType0x27 : ProtoBuf { @Serializable diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/receive/OnlinePush.ReqPush.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/receive/OnlinePush.ReqPush.kt index 4366a972e..7928a3071 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/receive/OnlinePush.ReqPush.kt +++ b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/receive/OnlinePush.ReqPush.kt @@ -16,10 +16,7 @@ package net.mamoe.mirai.qqandroid.network.protocol.packet.chat.receive import kotlinx.coroutines.CancellationException import kotlinx.coroutines.cancel -import kotlinx.io.core.ByteReadPacket -import kotlinx.io.core.discardExact -import kotlinx.io.core.readBytes -import kotlinx.io.core.readUInt +import kotlinx.io.core.* import kotlinx.serialization.Serializable import kotlinx.serialization.protobuf.ProtoId import net.mamoe.mirai.JavaFriendlyAPI @@ -43,6 +40,7 @@ import net.mamoe.mirai.qqandroid.network.protocol.data.jce.RequestPacket import net.mamoe.mirai.qqandroid.network.protocol.data.proto.Submsgtype0x27.SubMsgType0x27.* import net.mamoe.mirai.qqandroid.network.protocol.data.proto.Submsgtype0x44 import net.mamoe.mirai.qqandroid.network.protocol.data.proto.Submsgtype0xb3 +import net.mamoe.mirai.qqandroid.network.protocol.data.proto.Submsgtype0x115 import net.mamoe.mirai.qqandroid.network.protocol.data.proto.TroopTips0x857 import net.mamoe.mirai.qqandroid.network.protocol.packet.IncomingPacketFactory import net.mamoe.mirai.qqandroid.network.protocol.packet.OutgoingPacket @@ -449,6 +447,15 @@ internal object Transformers528 : Map by mapOf( sequenceOf(BotLeaveEvent.Active(group)) } else emptySequence() }, + //好友输入状态 + 0x115L to lambda528 {bot-> + val body=vProtobuf.loadAs(Submsgtype0x115.SubMsgType0x115.MsgBody.serializer()) + val friend = bot.getFriendOrNull(body.fromUin) + val item = body.msgNotifyItem + return@lambda528 if(friend!=null&&item!=null){ + sequenceOf(FriendInputStatusChangedEvent(friend,item.eventType==1)) + } else { emptySequence()} + }, // 群相关, ModFriendRemark, DelFriend, ModGroupProfile 0x27L to lambda528 { bot -> fun ModFriendRemark.transform(bot: QQAndroidBot): Sequence { diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/events/friend.kt b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/events/friend.kt index 887189b59..049a5d6e4 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/events/friend.kt +++ b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/events/friend.kt @@ -111,3 +111,11 @@ public data class FriendAvatarChangedEvent internal constructor( public override val friend: Friend ) : FriendEvent, Packet, AbstractEvent() +/** + * 好友输入状态改变的事件,当开始输入文字、退出聊天窗口或清空输入框时会触发此事件 + */ +public data class FriendInputStatusChangedEvent internal constructor( + public override val friend: Friend, + public val inputting: Boolean + +) : FriendEvent, Packet, AbstractEvent()