Skip to content

Commit

Permalink
Fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
Him188 committed May 29, 2020
1 parent 0a92840 commit 0af6639
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 23 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
package net.mamoe.mirai.qqandroid.message
@file:Suppress("DEPRECATION_ERROR")

import net.mamoe.mirai.message.data.FriendFlashImage
import net.mamoe.mirai.message.data.GroupFlashImage
import net.mamoe.mirai.message.data.md5
import net.mamoe.mirai.qqandroid.network.protocol.data.proto.HummerCommelem
import net.mamoe.mirai.qqandroid.network.protocol.data.proto.ImMsgBody
import net.mamoe.mirai.qqandroid.utils.io.serialization.toByteArray
package net.mamoe.mirai.qqandroid.message


internal fun GroupFlashImage.toJceData() = ImMsgBody.Elem(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* https://github.com/mamoe/mirai/blob/master/LICENSE
*/
@file:OptIn(LowLevelAPI::class)
@file:Suppress("EXPERIMENTAL_API_USAGE")
@file:Suppress("EXPERIMENTAL_API_USAGE", "DEPRECATION_ERROR")

package net.mamoe.mirai.qqandroid.message

Expand Down Expand Up @@ -100,10 +100,12 @@ internal fun MessageChain.toRichTextElems(forGroup: Boolean, withGeneralFlags: B
is CustomMessage -> {
@Suppress("UNCHECKED_CAST")
elements.add(
ImMsgBody.Elem(customElem = ImMsgBody.CustomElem(
enumType = MIRAI_CUSTOM_ELEM_TYPE,
data = CustomMessage.serialize(it.getFactory() as CustomMessage.Factory<CustomMessage>, it)
))
ImMsgBody.Elem(
customElem = ImMsgBody.CustomElem(
enumType = MIRAI_CUSTOM_ELEM_TYPE,
data = CustomMessage.dump(it.getFactory() as CustomMessage.Factory<CustomMessage>, it)
)
)
)
}
is At -> {
Expand Down Expand Up @@ -388,18 +390,22 @@ internal fun List<ImMsgBody.Elem>.joinToMessageChain(groupIdOrZero: Long, bot: B
element.customElem != null -> {
element.customElem.data.read {
kotlin.runCatching {
CustomMessage.deserialize(this)
CustomMessage.load(this)
}.fold(
onFailure = {
if (it is CustomMessage.Key.CustomMessageFullDataDeserializeInternalException) {
bot.logger.error("Internal error: " +
"exception while deserializing CustomMessage head data," +
" data=${element.customElem.data.toUHexString()}", it)
bot.logger.error(
"Internal error: " +
"exception while deserializing CustomMessage head data," +
" data=${element.customElem.data.toUHexString()}", it
)
} else {
it as CustomMessage.Key.CustomMessageFullDataDeserializeUserException
bot.logger.error("User error: " +
"exception while deserializing CustomMessage body," +
" body=${it.body.toUHexString()}", it)
bot.logger.error(
"User error: " +
"exception while deserializing CustomMessage body," +
" body=${it.body.toUHexString()}", it
)
}

},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* https://github.com/mamoe/mirai/blob/master/LICENSE
*/

@file:Suppress("EXPERIMENTAL_UNSIGNED_LITERALS", "NOTHING_TO_INLINE")
@file:Suppress("EXPERIMENTAL_UNSIGNED_LITERALS", "NOTHING_TO_INLINE", "INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
@file:JvmMultifileClass
@file:JvmName("Utils")

Expand Down Expand Up @@ -49,6 +49,7 @@ internal fun List<Byte>.toUHexString(separator: String = " ", offset: Int = 0, l
}
}

@kotlin.internal.LowPriorityInOverloadResolution
@JvmOverloads
@Suppress("DuplicatedCode") // false positive. foreach is not common to UByteArray and ByteArray
internal fun ByteArray.toUHexString(separator: String = " ", offset: Int = 0, length: Int = this.size - offset): String {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ private constructor(
return other is At && other.target == this.target && other.display == this.display
}

override fun toString(): String = "[mirai:at:$target]"
override fun toString(): String = "[mirai:at:$target,$display]"
override fun contentToString(): String = this.display

companion object Key : Message.Key<At> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ data class PokeMessage internal constructor(
}


private val stringValue = "[mirai:poke:$type,$id]"
private val stringValue = "[mirai:poke:$name,$type,$id]"

override fun toString(): String = stringValue
override fun contentToString(): String = "[戳一戳]"
Expand Down Expand Up @@ -163,7 +163,11 @@ data class VipFace internal constructor(
data class Kind(
val id: Int,
val name: String
)
) {
override fun toString(): String {
return "($id,$name)"
}
}

@Suppress("DEPRECATION_ERROR", "DEPRECATION", "INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
companion object : Message.Key<VipFace> {
Expand Down

0 comments on commit 0af6639

Please sign in to comment.