From c3fdee79ca10e6698febc9e61fe24dd58cec452f Mon Sep 17 00:00:00 2001 From: Christian Basler Date: Tue, 29 Sep 2015 07:13:27 +0200 Subject: [PATCH] Some bugfixes and added findMessages by sender --- .../java/ch/dissem/bitmessage/ports/MessageRepository.java | 2 ++ .../dissem/bitmessage/networking/DefaultNetworkHandler.java | 3 ++- .../dissem/bitmessage/repository/JdbcMessageRepository.java | 5 +++++ security-bc/build.gradle | 6 +++--- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/domain/src/main/java/ch/dissem/bitmessage/ports/MessageRepository.java b/domain/src/main/java/ch/dissem/bitmessage/ports/MessageRepository.java index b698a97..6d8970b 100644 --- a/domain/src/main/java/ch/dissem/bitmessage/ports/MessageRepository.java +++ b/domain/src/main/java/ch/dissem/bitmessage/ports/MessageRepository.java @@ -34,6 +34,8 @@ public interface MessageRepository { List findMessages(Status status, BitmessageAddress recipient); + List<Plaintext> findMessages(BitmessageAddress sender); + void save(Plaintext message); void remove(Plaintext message); diff --git a/networking/src/main/java/ch/dissem/bitmessage/networking/DefaultNetworkHandler.java b/networking/src/main/java/ch/dissem/bitmessage/networking/DefaultNetworkHandler.java index aead8e8..b6b3c69 100644 --- a/networking/src/main/java/ch/dissem/bitmessage/networking/DefaultNetworkHandler.java +++ b/networking/src/main/java/ch/dissem/bitmessage/networking/DefaultNetworkHandler.java @@ -221,7 +221,8 @@ public class DefaultNetworkHandler implements NetworkHandler, ContextHolder { i++; } return new Property("network", null, - new Property("connectionManager", connectionManager.isAlive() ? "running" : "stopped"), + new Property("connectionManager", + connectionManager != null && connectionManager.isAlive() ? "running" : "stopped"), new Property("connections", null, streamProperties) ); } diff --git a/repositories/src/main/java/ch/dissem/bitmessage/repository/JdbcMessageRepository.java b/repositories/src/main/java/ch/dissem/bitmessage/repository/JdbcMessageRepository.java index ec89e68..759012b 100644 --- a/repositories/src/main/java/ch/dissem/bitmessage/repository/JdbcMessageRepository.java +++ b/repositories/src/main/java/ch/dissem/bitmessage/repository/JdbcMessageRepository.java @@ -101,6 +101,11 @@ public class JdbcMessageRepository extends JdbcHelper implements MessageReposito return find("status='" + status.name() + "'"); } + @Override + public List<Plaintext> findMessages(BitmessageAddress sender) { + return find("sender='" + sender.getAddress() + "'"); + } + private List<Plaintext> find(String where) { List<Plaintext> result = new LinkedList<>(); try (Connection connection = config.getConnection()) { diff --git a/security-bc/build.gradle b/security-bc/build.gradle index 48f14d1..ff37994 100644 --- a/security-bc/build.gradle +++ b/security-bc/build.gradle @@ -2,9 +2,9 @@ uploadArchives { repositories { mavenDeployer { pom.project { - name 'Jabit Spongy Security' - artifactId = 'jabit-security-spongy' - description 'The Security implementation using spongy castle (needed for Android)' + name 'Jabit Bouncy Security' + artifactId = 'jabit-security-bouncy' + description 'The Security implementation using bouncy castle' } } }