Skip to content
Snippets Groups Projects
Verified Commit 1617a95b authored by akwizgran's avatar akwizgran Committed by Torsten Grote
Browse files

Only include "body" for headers that can have bodies.

parent 6f547187
No related branches found
No related tags found
No related merge requests found
......@@ -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()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment