forked from Qortal/qortal
Include transaction reference in chat messages returned by API call GET /chat/messages
This commit is contained in:
parent
0164bca2d7
commit
200a97184c
@ -12,6 +12,8 @@ public class ChatMessage {
|
||||
|
||||
private int txGroupId;
|
||||
|
||||
private byte[] reference;
|
||||
|
||||
private byte[] senderPublicKey;
|
||||
|
||||
/* Address of sender */
|
||||
@ -37,10 +39,12 @@ public class ChatMessage {
|
||||
}
|
||||
|
||||
// For repository use
|
||||
public ChatMessage(long timestamp, int txGroupId, byte[] senderPublicKey, String sender, String senderName,
|
||||
String recipient, String recipientName, byte[] data, boolean isText, boolean isEncrypted) {
|
||||
public ChatMessage(long timestamp, int txGroupId, byte[] reference, byte[] senderPublicKey, String sender,
|
||||
String senderName, String recipient, String recipientName, byte[] data, boolean isText,
|
||||
boolean isEncrypted) {
|
||||
this.timestamp = timestamp;
|
||||
this.txGroupId = txGroupId;
|
||||
this.reference = reference;
|
||||
this.senderPublicKey = senderPublicKey;
|
||||
this.sender = sender;
|
||||
this.senderName = senderName;
|
||||
@ -59,6 +63,10 @@ public class ChatMessage {
|
||||
return this.txGroupId;
|
||||
}
|
||||
|
||||
public byte[] getReference() {
|
||||
return this.reference;
|
||||
}
|
||||
|
||||
public byte[] getSenderPublicKey() {
|
||||
return this.senderPublicKey;
|
||||
}
|
||||
|
@ -32,8 +32,9 @@ public class HSQLDBChatRepository implements ChatRepository {
|
||||
|
||||
StringBuilder sql = new StringBuilder(1024);
|
||||
|
||||
sql.append("SELECT created_when, tx_group_id, creator, sender, SenderNames.name, "
|
||||
+ "recipient, RecipientNames.name, data, is_text, is_encrypted "
|
||||
sql.append("SELECT created_when, tx_group_id, Transactions.reference, creator, "
|
||||
+ "sender, SenderNames.name, recipient, RecipientNames.name, "
|
||||
+ "data, is_text, is_encrypted "
|
||||
+ "FROM ChatTransactions "
|
||||
+ "JOIN Transactions USING (signature) "
|
||||
+ "LEFT OUTER JOIN Names AS SenderNames ON SenderNames.owner = sender "
|
||||
@ -90,17 +91,18 @@ public class HSQLDBChatRepository implements ChatRepository {
|
||||
do {
|
||||
long timestamp = resultSet.getLong(1);
|
||||
int groupId = resultSet.getInt(2);
|
||||
byte[] senderPublicKey = resultSet.getBytes(3);
|
||||
String sender = resultSet.getString(4);
|
||||
String senderName = resultSet.getString(5);
|
||||
String recipient = resultSet.getString(6);
|
||||
String recipientName = resultSet.getString(7);
|
||||
byte[] data = resultSet.getBytes(8);
|
||||
boolean isText = resultSet.getBoolean(9);
|
||||
boolean isEncrypted = resultSet.getBoolean(10);
|
||||
byte[] reference = resultSet.getBytes(3);
|
||||
byte[] senderPublicKey = resultSet.getBytes(4);
|
||||
String sender = resultSet.getString(5);
|
||||
String senderName = resultSet.getString(6);
|
||||
String recipient = resultSet.getString(7);
|
||||
String recipientName = resultSet.getString(8);
|
||||
byte[] data = resultSet.getBytes(9);
|
||||
boolean isText = resultSet.getBoolean(10);
|
||||
boolean isEncrypted = resultSet.getBoolean(11);
|
||||
|
||||
ChatMessage chatMessage = new ChatMessage(timestamp, groupId, senderPublicKey, sender, senderName,
|
||||
recipient, recipientName, data, isText, isEncrypted);
|
||||
ChatMessage chatMessage = new ChatMessage(timestamp, groupId, reference, senderPublicKey, sender,
|
||||
senderName, recipient, recipientName, data, isText, isEncrypted);
|
||||
|
||||
chatMessages.add(chatMessage);
|
||||
} while (resultSet.next());
|
||||
|
Loading…
Reference in New Issue
Block a user