This commit is contained in:
Simplxs 2024-02-21 02:16:16 +08:00
parent e9884a5fa8
commit 18126b1fda
No known key found for this signature in database
GPG Key ID: E23537FF14DD6507
6 changed files with 40 additions and 35 deletions

View File

@ -25,6 +25,6 @@ data class ForwardHead(
@ProtoNumber(1) val u1: Int? = null, @ProtoNumber(1) val u1: Int? = null,
@ProtoNumber(2) val u2: Int? = null, @ProtoNumber(2) val u2: Int? = null,
@ProtoNumber(3) val u3: Int? = null, @ProtoNumber(3) val u3: Int? = null,
@ProtoNumber(4) val u4: String? = null, @ProtoNumber(4) val ub641: String? = null,
@ProtoNumber(5) val Avatar: String? = null @ProtoNumber(5) val Avatar: String? = null
) )

View File

@ -20,6 +20,7 @@ data class MessageHead(
@Serializable @Serializable
data class MessageForward( data class MessageForward(
@ProtoNumber(6) val friendName: String? = null, @ProtoNumber(6) val friendName: String? = null,
@ProtoNumber(11) val u1: Int? = null,
) )
@Serializable @Serializable
@ -28,4 +29,5 @@ data class GroupInfo(
@ProtoNumber(4) val memberCard: String? = null, @ProtoNumber(4) val memberCard: String? = null,
@ProtoNumber(5) val u1: Int? = null, @ProtoNumber(5) val u1: Int? = null,
@ProtoNumber(7) val groupName: String? = null, @ProtoNumber(7) val groupName: String? = null,
@ProtoNumber(10) val u2: Int? = null,
) )

View File

@ -8,6 +8,4 @@ data class CommonElement(
@ProtoNumber(1) val type: Int? = null, @ProtoNumber(1) val type: Int? = null,
@ProtoNumber(2) val data: ByteArray? = null, @ProtoNumber(2) val data: ByteArray? = null,
@ProtoNumber(3) val u1: Int? = null, @ProtoNumber(3) val u1: Int? = null,
) )

View File

@ -11,28 +11,30 @@ data class TextElement(
@ProtoNumber(4) val attr7Buf: ByteArray? = null, @ProtoNumber(4) val attr7Buf: ByteArray? = null,
@ProtoNumber(11) val buf: ByteArray? = null, @ProtoNumber(11) val buf: ByteArray? = null,
@ProtoNumber(12) val pbReserve: TextResvAttr? = null, @ProtoNumber(12) val pbReserve: TextResvAttr? = null,
) ) {
companion object {
@Serializable
data class TextResvAttr(
@ProtoNumber(1) val wording: ByteArray? = null,
@ProtoNumber(2) val textAnalysisResult: Int? = null,
@ProtoNumber(3) val atType: Int? = null,
@ProtoNumber(4) val atMemberUin: Long? = null,
@ProtoNumber(5) val atMemberTinyid: Long? = null,
@ProtoNumber(6) val atChannelInfo: ExtChannelInfo? = null,
@ProtoNumber(7) val atRoleInfo: ExtRoleInfo? = null,
)
@Serializable @Serializable
data class TextResvAttr( data class ExtChannelInfo(
@ProtoNumber(1) val wording: ByteArray? = null, @ProtoNumber(1) val guildId: Long? = null,
@ProtoNumber(2) val textAnalysisResult: Int? = null, @ProtoNumber(2) val channelId: Long? = null,
@ProtoNumber(3) val atType: Int? = null, )
@ProtoNumber(4) val atMemberUin: Long? = null,
@ProtoNumber(5) val atMemberTinyid: Long? = null,
@ProtoNumber(6) val atChannelInfo: ExtChannelInfo? = null,
@ProtoNumber(7) val atRoleInfo: ExtRoleInfo? = null,
)
@Serializable @Serializable
data class ExtChannelInfo( data class ExtRoleInfo(
@ProtoNumber(1) val guildId: Long? = null, @ProtoNumber(1) val id: Long? = null,
@ProtoNumber(2) val channelId: Long? = null, @ProtoNumber(2) val info: ByteArray? = null,
) @ProtoNumber(3) val flag: Int? = null,
)
@Serializable }
data class ExtRoleInfo( }
@ProtoNumber(1) val id: Long? = null,
@ProtoNumber(2) val info: ByteArray? = null,
@ProtoNumber(3) val flag: Int? = null,
)

View File

@ -285,10 +285,11 @@ internal object MsgSvc : BaseSvc() {
ProtoBuf.encodeToByteArray(req) ProtoBuf.encodeToByteArray(req)
) ?: return Result.failure(Exception("unable to get multi message")) ) ?: return Result.failure(Exception("unable to get multi message"))
val rsp = ProtoBuf.decodeFromByteArray<LongMsgRsp>(buffer.slice(4)) val rsp = ProtoBuf.decodeFromByteArray<LongMsgRsp>(buffer.slice(4))
val msg = DeflateTools.ungzip( val zippedPayload = DeflateTools.ungzip(
rsp.recvResult?.payload ?: return Result.failure(Exception("unable to get multi message")) rsp.recvResult?.payload ?: return Result.failure(Exception("unable to get multi message"))
) )
val payload = ProtoBuf.decodeFromByteArray<LongMsgPayload>(msg) LogCenter.log(zippedPayload.toHexString(), Level.DEBUG)
val payload = ProtoBuf.decodeFromByteArray<LongMsgPayload>(zippedPayload)
payload.action?.forEach { payload.action?.forEach {
if (it.command == "MultiMsg") { if (it.command == "MultiMsg") {
return Result.success(it.data?.body?.map { msg -> return Result.success(it.data?.body?.map { msg ->
@ -297,15 +298,15 @@ internal object MsgSvc : BaseSvc() {
MessageDetail( MessageDetail(
time = msg.content?.msgTime?.toInt() ?: 0, time = msg.content?.msgTime?.toInt() ?: 0,
msgType = MessageHelper.obtainDetailTypeByMsgType(chatType), msgType = MessageHelper.obtainDetailTypeByMsgType(chatType),
msgId = MessageHelper.generateMsgIdHash(chatType, msg.content!!.msgViaRandom), msgId = 0, // MessageHelper.generateMsgIdHash(chatType, msg.content!!.msgViaRandom), msgViaRandom 为空
realId = msg.content!!.msgSeq.toInt(), realId = msg.content!!.msgSeq.toInt(),
sender = MessageSender( sender = MessageSender(
msg.head?.peer ?: 0, msg.head?.peer ?: 0,
msg.head!!.groupInfo!!.memberCard ?: "", msg.head?.groupInfo?.memberCard?.ifEmpty { msg.head?.forward?.friendName } ?: "",
"unknown", "unknown",
0, 0,
msg.head!!.peerUid!!, msg.head?.peerUid ?: "u_",
msg.head!!.peerUid!! msg.head?.peerUid?: "u_"
), ),
message = msg.body?.rich?.elements?.toSegments(chatType, msg.head?.peer.toString(), "0") message = msg.body?.rich?.elements?.toSegments(chatType, msg.head?.peer.toString(), "0")
?.toListMap() ?: emptyList(), ?.toListMap() ?: emptyList(),

View File

@ -124,7 +124,7 @@ internal object SendForwardMessage : IActionHandler() {
u1 = 0, u1 = 0,
u2 = 0, u2 = 0,
u3 = if (record.chatType == MsgConstant.KCHATTYPEGROUP) 0 else 2, u3 = if (record.chatType == MsgConstant.KCHATTYPEGROUP) 0 else 2,
u4 = "", ub641 = "",
Avatar = "" Avatar = ""
) )
), ),
@ -163,7 +163,9 @@ internal object SendForwardMessage : IActionHandler() {
} else if (data.containsKey("content")) { } else if (data.containsKey("content")) {
PushMsgBody( PushMsgBody(
head = MessageHead( head = MessageHead(
peer = data["uin"]?.asLong ?: TicketSvc.getUin().toLong(),
peerUid = data["uid"]?.asString ?: TicketSvc.getUid() peerUid = data["uid"]?.asString ?: TicketSvc.getUid()
), ),
content = MessageContent( content = MessageContent(
msgType = 529, msgType = 529,
@ -177,7 +179,7 @@ internal object SendForwardMessage : IActionHandler() {
u1 = 0, u1 = 0,
u2 = 0, u2 = 0,
u3 = 2, u3 = 2,
u4 = "", ub641 = "",
Avatar = "" Avatar = ""
) )
), ),