mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-12 10:49:06 +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.headless.json.JsonDict
|
||||
|
||||
internal fun PrivateMessageHeader.output(contactId: ContactId, body: String?) = JsonDict(
|
||||
internal fun PrivateMessageHeader.output(contactId: ContactId) = JsonDict(
|
||||
"type" to "PrivateMessage",
|
||||
"contactId" to contactId.int,
|
||||
"timestamp" to timestamp,
|
||||
@@ -14,10 +14,15 @@ internal fun PrivateMessageHeader.output(contactId: ContactId, body: String?) =
|
||||
"sent" to isSent,
|
||||
"local" to isLocal,
|
||||
"id" to id.bytes,
|
||||
"groupId" to groupId.bytes,
|
||||
"body" to body
|
||||
"groupId" to groupId.bytes
|
||||
)
|
||||
|
||||
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(
|
||||
"type" to "PrivateMessage",
|
||||
"contactId" to contactId.int,
|
||||
|
||||
@@ -12,7 +12,7 @@ import org.briarproject.briar.api.sharing.InvitationResponse
|
||||
import org.briarproject.briar.headless.json.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(
|
||||
"sessionId" to sessionId.bytes,
|
||||
"accepted" to wasAccepted()
|
||||
|
||||
Reference in New Issue
Block a user