mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-19 06:09:55 +01:00
Only include "body" for headers that can have bodies.
This commit is contained in:
@@ -5,7 +5,7 @@ import org.briarproject.briar.api.messaging.PrivateMessage
|
|||||||
import org.briarproject.briar.api.messaging.PrivateMessageHeader
|
import org.briarproject.briar.api.messaging.PrivateMessageHeader
|
||||||
import org.briarproject.briar.headless.json.JsonDict
|
import org.briarproject.briar.headless.json.JsonDict
|
||||||
|
|
||||||
internal fun PrivateMessageHeader.output(contactId: ContactId, body: String?) = JsonDict(
|
internal fun PrivateMessageHeader.output(contactId: ContactId) = JsonDict(
|
||||||
"type" to "PrivateMessage",
|
"type" to "PrivateMessage",
|
||||||
"contactId" to contactId.int,
|
"contactId" to contactId.int,
|
||||||
"timestamp" to timestamp,
|
"timestamp" to timestamp,
|
||||||
@@ -14,10 +14,15 @@ internal fun PrivateMessageHeader.output(contactId: ContactId, body: String?) =
|
|||||||
"sent" to isSent,
|
"sent" to isSent,
|
||||||
"local" to isLocal,
|
"local" to isLocal,
|
||||||
"id" to id.bytes,
|
"id" to id.bytes,
|
||||||
"groupId" to groupId.bytes,
|
"groupId" to groupId.bytes
|
||||||
"body" to body
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
internal fun PrivateMessageHeader.output(contactId: ContactId, body: String?): JsonDict {
|
||||||
|
val dict = output(contactId)
|
||||||
|
dict["body"] = body
|
||||||
|
return dict
|
||||||
|
}
|
||||||
|
|
||||||
internal fun PrivateMessage.output(contactId: ContactId, body: String) = JsonDict(
|
internal fun PrivateMessage.output(contactId: ContactId, body: String) = JsonDict(
|
||||||
"type" to "PrivateMessage",
|
"type" to "PrivateMessage",
|
||||||
"contactId" to contactId.int,
|
"contactId" to contactId.int,
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import org.briarproject.briar.api.sharing.InvitationResponse
|
|||||||
import org.briarproject.briar.headless.json.JsonDict
|
import org.briarproject.briar.headless.json.JsonDict
|
||||||
|
|
||||||
internal fun PrivateResponse.output(contactId: ContactId): JsonDict {
|
internal fun PrivateResponse.output(contactId: ContactId): JsonDict {
|
||||||
val dict = (this as PrivateMessageHeader).output(contactId, null)
|
val dict = (this as PrivateMessageHeader).output(contactId)
|
||||||
dict.putAll(
|
dict.putAll(
|
||||||
"sessionId" to sessionId.bytes,
|
"sessionId" to sessionId.bytes,
|
||||||
"accepted" to wasAccepted()
|
"accepted" to wasAccepted()
|
||||||
|
|||||||
Reference in New Issue
Block a user