No need to unwrap Bytes before adding to dictionary.

This commit is contained in:
akwizgran
2016-03-01 13:08:51 +00:00
parent 5998412a8a
commit 88ab694af8
3 changed files with 10 additions and 12 deletions

View File

@@ -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);

View File

@@ -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);

View File

@@ -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);