stable name for withheld

This commit is contained in:
Valere 2022-07-12 09:30:43 +02:00
parent 6b0f8318b7
commit 7a3f2bb240
6 changed files with 7 additions and 6 deletions

1
changelog.d/5115.bugfix Normal file
View file

@ -0,0 +1 @@
Stop using unstable names for withheld codes

View file

@ -87,7 +87,7 @@ object EventType {
// Key share events
const val ROOM_KEY_REQUEST = "m.room_key_request"
const val FORWARDED_ROOM_KEY = "m.forwarded_room_key"
const val ROOM_KEY_WITHHELD = "org.matrix.room_key.withheld"
val ROOM_KEY_WITHHELD = listOf("m.room_key.withheld", "org.matrix.room_key.withheld")
const val REQUEST_SECRET = "m.secret.request"
const val SEND_SECRET = "m.secret.send"

View file

@ -820,7 +820,7 @@ internal class DefaultCryptoService @Inject constructor(
EventType.SEND_SECRET -> {
onSecretSendReceived(event)
}
EventType.ROOM_KEY_WITHHELD -> {
in EventType.ROOM_KEY_WITHHELD -> {
onKeyWithHeldReceived(event)
}
else -> {
@ -869,7 +869,7 @@ internal class DefaultCryptoService @Inject constructor(
senderKey = withHeldContent.senderKey,
fromDevice = withHeldContent.fromDevice,
event = Event(
type = EventType.ROOM_KEY_WITHHELD,
type = EventType.ROOM_KEY_WITHHELD.first(),
senderId = senderId,
content = event.getClearContent()
)

View file

@ -315,7 +315,7 @@ internal class IncomingKeyRequestManager @Inject constructor(
)
val params = SendToDeviceTask.Params(
EventType.ROOM_KEY_WITHHELD,
EventType.ROOM_KEY_WITHHELD.first(),
MXUsersDevicesMap<Any>().apply {
setObject(request.requestingUserId, request.requestingDeviceId, withHeldContent)
}

View file

@ -365,7 +365,7 @@ internal class MXMegolmEncryption(
fromDevice = myDeviceId
)
val params = SendToDeviceTask.Params(
EventType.ROOM_KEY_WITHHELD,
EventType.ROOM_KEY_WITHHELD.first(),
MXUsersDevicesMap<Any>().apply {
targets.forEach {
setObject(it.userId, it.deviceId, withHeldContent)

View file

@ -117,7 +117,7 @@ internal open class OutgoingKeyRequestEntity(
private fun eventToResult(event: Event): RequestResult? {
return when (event.getClearType()) {
EventType.ROOM_KEY_WITHHELD -> {
in EventType.ROOM_KEY_WITHHELD -> {
event.content.toModel<RoomKeyWithHeldContent>()?.code?.let {
RequestResult.Failure(it)
}