Skip to content

Commit

Permalink
fix: wrong code in group recall
Browse files Browse the repository at this point in the history
  • Loading branch information
fuqiuluo committed Jul 23, 2024
1 parent e5e7837 commit 47a6372
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
3 changes: 2 additions & 1 deletion app/src/main/java/moe/fuqiuluo/entries/GroupRecallMessage.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ data class C2cRecallMsgInfo(

@Serializable
data class GroupRecallMessage(
@ProtoNumber(4) val peerId: Long,
@ProtoNumber(1) val type: UInt,
@ProtoNumber(4) val peerId: UInt,
@ProtoNumber(11) val operation: GroupRecallOperation,
)

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/moe/fuqiuluo/entries/MessagePush.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ data class Message(

@Serializable
data class MessageHead(
@ProtoNumber(1) val peerId: ULong = ULong.MIN_VALUE,
@ProtoNumber(1) val peerId: UInt = UInt.MIN_VALUE,
@ProtoNumber(2) val peerUid: String? = null,
@ProtoNumber(5) val targetId: Long = Long.MIN_VALUE,
@ProtoNumber(6) val targetUid: String? = null
Expand Down
6 changes: 4 additions & 2 deletions app/src/main/java/moe/qwq/miko/internals/AioListener.kt
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ override fun onRecvMsg(recordLisrt: ArrayList<MsgRecord>) {
GlobalScope.launch {
val reader = ByteReadPacket(richMsg)
val buffer = try {
if (reader.readUInt() == message.msgHead.peerId.toUInt()) {
if (reader.readUInt() == message.msgHead.peerId) {
reader.discardExact(1)
reader.readBytes(reader.readShort().toInt())
} else richMsg
Expand All @@ -160,7 +160,9 @@ override fun onRecvMsg(recordLisrt: ArrayList<MsgRecord>) {
}
val recallData = ProtoBuf.decodeFromByteArray<GroupRecallMessage>(buffer)

val groupCode = GroupHelper.groupUin2GroupCode(message.msgHead.peerId.toLong())
if (recallData.type != 7u || recallData.peerId == 0u) return@launch

val groupCode = recallData.peerId.toLong()
val msgUid = message.content.msgUid
val targetUid = recallData.operation.msgInfo?.senderUid ?: ""
val operatorUid = recallData.operation.operatorUid ?: ""
Expand Down

0 comments on commit 47a6372

Please sign in to comment.