public void markMessageAsRemovedOrRecovered(String id) {
   Message message = new Message();
   message.setId(id);
   message.setMessageCode(Message.REMOVED_MESSAGE_CODE);
   data.add(message);
   saveMessagesToJsonFile(MESSAGES_EXTERNAL_STORAGE);
 }
 public Message editMessage(String id, String updatedText) {
   Message message = new Message();
   message.setId(id);
   message.setText(updatedText);
   message.setMessageCode(Message.EDITED_MESSAGE_CODE);
   data.add(message);
   saveMessagesToJsonFile(MESSAGES_EXTERNAL_STORAGE);
   return message;
 }
Пример #3
0
  public void sendMessage(Message message, IP remoteAddress, int remotePort) throws IOException {
    message.setId(JGN.getUniqueLong());

    if (message instanceof CertifiedMessage) {
      getMessageCertifier().enqueue((CertifiedMessage) message, remoteAddress, remotePort);
    }
    if (message instanceof OrderedMessage) {
      if (((OrderedMessage) message).getOrderId() == -1) {
        ((OrderedMessage) message)
            .setOrderId(OrderedMessage.createUniqueId(((OrderedMessage) message).getOrderGroup()));
      }
    }
    resendMessage(message, remoteAddress, remotePort);
  }