Search in sources :

Example 1 with MailboxMessage

use of io.bitsquare.p2p.messaging.MailboxMessage in project bitsquare by bitsquare.

the class BuyerAsOffererProtocol method doApplyMailboxMessage.

///////////////////////////////////////////////////////////////////////////////////////////
// Mailbox
///////////////////////////////////////////////////////////////////////////////////////////
@Override
public void doApplyMailboxMessage(Message message, Trade trade) {
    this.trade = trade;
    if (message instanceof MailboxMessage) {
        MailboxMessage mailboxMessage = (MailboxMessage) message;
        NodeAddress peerNodeAddress = mailboxMessage.getSenderNodeAddress();
        if (message instanceof FinalizePayoutTxRequest) {
            handle((FinalizePayoutTxRequest) message, peerNodeAddress);
        } else if (message instanceof DepositTxPublishedMessage) {
            handle((DepositTxPublishedMessage) message, peerNodeAddress);
        }
    }
}
Also used : FinalizePayoutTxRequest(io.bitsquare.trade.protocol.trade.messages.FinalizePayoutTxRequest) DepositTxPublishedMessage(io.bitsquare.trade.protocol.trade.messages.DepositTxPublishedMessage) NodeAddress(io.bitsquare.p2p.NodeAddress) MailboxMessage(io.bitsquare.p2p.messaging.MailboxMessage)

Example 2 with MailboxMessage

use of io.bitsquare.p2p.messaging.MailboxMessage in project bitsquare by bitsquare.

the class TradeTask method removeMailboxMessageAfterProcessing.

protected void removeMailboxMessageAfterProcessing() {
    if (processModel.getTradeMessage() instanceof MailboxMessage) {
        DecryptedMsgWithPubKey mailboxMessage = trade.getMailboxMessage();
        if (mailboxMessage != null && mailboxMessage.message.equals(processModel.getTradeMessage())) {
            log.debug("Remove mailboxMessage from P2P network. mailboxMessage = " + mailboxMessage);
            processModel.getP2PService().removeEntryFromMailbox(mailboxMessage);
            trade.setMailboxMessage(null);
        }
    }
}
Also used : DecryptedMsgWithPubKey(io.bitsquare.crypto.DecryptedMsgWithPubKey) MailboxMessage(io.bitsquare.p2p.messaging.MailboxMessage)

Example 3 with MailboxMessage

use of io.bitsquare.p2p.messaging.MailboxMessage in project bitsquare by bitsquare.

the class SellerAsOffererProtocol method doApplyMailboxMessage.

///////////////////////////////////////////////////////////////////////////////////////////
// Mailbox
///////////////////////////////////////////////////////////////////////////////////////////
@Override
public void doApplyMailboxMessage(Message message, Trade trade) {
    this.trade = trade;
    NodeAddress peerNodeAddress = ((MailboxMessage) message).getSenderNodeAddress();
    if (message instanceof PayoutTxFinalizedMessage) {
        handle((PayoutTxFinalizedMessage) message, peerNodeAddress);
    } else {
        if (message instanceof FiatTransferStartedMessage) {
            handle((FiatTransferStartedMessage) message, peerNodeAddress);
        } else if (message instanceof DepositTxPublishedMessage) {
            handle((DepositTxPublishedMessage) message, peerNodeAddress);
        }
    }
}
Also used : NodeAddress(io.bitsquare.p2p.NodeAddress) MailboxMessage(io.bitsquare.p2p.messaging.MailboxMessage)

Aggregations

MailboxMessage (io.bitsquare.p2p.messaging.MailboxMessage)3 NodeAddress (io.bitsquare.p2p.NodeAddress)2 DecryptedMsgWithPubKey (io.bitsquare.crypto.DecryptedMsgWithPubKey)1 DepositTxPublishedMessage (io.bitsquare.trade.protocol.trade.messages.DepositTxPublishedMessage)1 FinalizePayoutTxRequest (io.bitsquare.trade.protocol.trade.messages.FinalizePayoutTxRequest)1