Unverified Commit 88ab694a authored by akwizgran's avatar akwizgran
Browse files

No need to unwrap Bytes before adding to dictionary.

parent 5998412a
......@@ -61,15 +61,14 @@ class ForumManagerImpl implements ForumManager {
try {
BdfDictionary meta = new BdfDictionary();
meta.put("timestamp", p.getMessage().getTimestamp());
if (p.getParent() != null)
meta.put("parent", p.getParent().getBytes());
if (p.getParent() != null) meta.put("parent", p.getParent());
if (p.getAuthor() != null) {
Author a = p.getAuthor();
BdfDictionary author = new BdfDictionary();
author.put("id", a.getId().getBytes());
author.put("name", a.getName());
author.put("publicKey", a.getPublicKey());
meta.put("author", author);
BdfDictionary authorMeta = new BdfDictionary();
authorMeta.put("id", a.getId());
authorMeta.put("name", a.getName());
authorMeta.put("publicKey", a.getPublicKey());
meta.put("author", authorMeta);
}
meta.put("contentType", p.getContentType());
meta.put("local", true);
......
......@@ -82,7 +82,7 @@ class ForumPostValidator extends BdfMessageValidator {
KeyParser keyParser = crypto.getSignatureKeyParser();
PublicKey key = keyParser.parsePublicKey(author.getPublicKey());
// Serialise the data to be signed
BdfList signed = BdfList.of(g.getId(), timestamp, parentId,
BdfList signed = BdfList.of(g.getId(), timestamp, parent,
authorList, contentType, body);
// Verify the signature
Signature signature = crypto.getSignature();
......@@ -100,10 +100,10 @@ class ForumPostValidator extends BdfMessageValidator {
// Return the metadata
BdfDictionary meta = new BdfDictionary();
meta.put("timestamp", timestamp);
if (parentId != null) meta.put("parent", parentId);
if (parent != null) meta.put("parent", parent);
if (author != null) {
BdfDictionary authorMeta = new BdfDictionary();
authorMeta.put("id", author.getId().getBytes());
authorMeta.put("id", author.getId());
authorMeta.put("name", author.getName());
authorMeta.put("publicKey", author.getPublicKey());
meta.put("author", authorMeta);
......
......@@ -83,8 +83,7 @@ class MessagingManagerImpl implements MessagingManager, AddContactHook,
try {
BdfDictionary meta = new BdfDictionary();
meta.put("timestamp", m.getMessage().getTimestamp());
if (m.getParent() != null)
meta.put("parent", m.getParent().getBytes());
if (m.getParent() != null) meta.put("parent", m.getParent());
meta.put("contentType", m.getContentType());
meta.put("local", true);
meta.put("read", true);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment