diff --git a/core/src/main/java/bisq/core/support/SupportManager.java b/core/src/main/java/bisq/core/support/SupportManager.java index 82ecc106d38..d353ed06068 100644 --- a/core/src/main/java/bisq/core/support/SupportManager.java +++ b/core/src/main/java/bisq/core/support/SupportManager.java @@ -18,6 +18,7 @@ package bisq.core.support; import bisq.core.btc.setup.WalletsSetup; +import bisq.core.locale.Res; import bisq.core.support.messages.ChatMessage; import bisq.core.support.messages.SupportMessage; @@ -191,7 +192,10 @@ private void onAckMessage(AckMessage ackMessage) { public ChatMessage sendChatMessage(ChatMessage message) { NodeAddress peersNodeAddress = getPeerNodeAddress(message); PubKeyRing receiverPubKeyRing = getPeerPubKeyRing(message); - if (receiverPubKeyRing != null) { + if (peersNodeAddress == null || receiverPubKeyRing == null) { + UserThread.runAfter(() -> + message.setSendMessageError(Res.get("support.receiverNotKnown")), 1); + } else { log.info("Send {} to peer {}. tradeId={}, uid={}", message.getClass().getSimpleName(), peersNodeAddress, message.getTradeId(), message.getUid()); diff --git a/core/src/main/java/bisq/core/support/SupportSession.java b/core/src/main/java/bisq/core/support/SupportSession.java index b4df4ed0b10..0354ddba7f5 100644 --- a/core/src/main/java/bisq/core/support/SupportSession.java +++ b/core/src/main/java/bisq/core/support/SupportSession.java @@ -46,7 +46,7 @@ public boolean isClient() { public abstract String getTradeId(); - public abstract PubKeyRing getClientPubKeyRing(); + public abstract int getClientId(); public abstract ObservableList getObservableChatMessageList(); diff --git a/core/src/main/java/bisq/core/support/dispute/DisputeSession.java b/core/src/main/java/bisq/core/support/dispute/DisputeSession.java index cebe715e16d..d381a0eaaf6 100644 --- a/core/src/main/java/bisq/core/support/dispute/DisputeSession.java +++ b/core/src/main/java/bisq/core/support/dispute/DisputeSession.java @@ -57,9 +57,14 @@ public String getTradeId() { } @Override - public PubKeyRing getClientPubKeyRing() { + public int getClientId() { // Get pubKeyRing of trader. Arbitrator is considered server for the chat session - return dispute != null ? dispute.getTraderPubKeyRing() : null; + try { + return dispute.getTraderPubKeyRing().hashCode(); + } catch (NullPointerException e) { + log.warn("Unable to get traderPubKeyRing from Dispute - {}", e.toString()); + } + return 0; } @Override diff --git a/core/src/main/java/bisq/core/support/traderchat/TradeChatSession.java b/core/src/main/java/bisq/core/support/traderchat/TradeChatSession.java index c465d5ff72c..e69a18c3f66 100644 --- a/core/src/main/java/bisq/core/support/traderchat/TradeChatSession.java +++ b/core/src/main/java/bisq/core/support/traderchat/TradeChatSession.java @@ -48,12 +48,15 @@ public String getTradeId() { } @Override - public PubKeyRing getClientPubKeyRing() { + public int getClientId() { // TODO remove that client-server concept for trade chat // Get pubKeyRing of taker. Maker is considered server for chat sessions - if (trade != null && trade.getContract() != null) - return trade.getContract().getTakerPubKeyRing(); - return null; + try { + return trade.getContract().getTakerPubKeyRing().hashCode(); + } catch (NullPointerException e) { + log.warn("Unable to get takerPubKeyRing from Trade Contract - {}", e.toString()); + } + return 0; } @Override diff --git a/core/src/main/resources/i18n/displayStrings.properties b/core/src/main/resources/i18n/displayStrings.properties index 3339f829ecd..11290f694ae 100644 --- a/core/src/main/resources/i18n/displayStrings.properties +++ b/core/src/main/resources/i18n/displayStrings.properties @@ -1105,6 +1105,7 @@ support.noTickets=There are no open tickets support.sendingMessage=Sending Message... support.receiverNotOnline=Receiver is not online. Message is saved to their mailbox. support.sendMessageError=Sending message failed. Error: {0} +support.receiverNotKnown=Receiver not known support.wrongVersion=The offer in that dispute has been created with an older version of Bisq.\n\ You cannot close that dispute with your version of the application.\n\n\ Please use an older version with protocol version {0} diff --git a/desktop/src/main/java/bisq/desktop/main/shared/ChatView.java b/desktop/src/main/java/bisq/desktop/main/shared/ChatView.java index 60d49a067fa..6c53d843c83 100644 --- a/desktop/src/main/java/bisq/desktop/main/shared/ChatView.java +++ b/desktop/src/main/java/bisq/desktop/main/shared/ChatView.java @@ -648,7 +648,7 @@ private ChatMessage sendDisputeDirectMessage(String text, ArrayList ChatMessage message = new ChatMessage( supportManager.getSupportType(), supportSession.getTradeId(), - supportSession.getClientPubKeyRing().hashCode(), + supportSession.getClientId(), supportSession.isClient(), text, supportManager.getMyAddress(),