Add message timestamp to Java API

This commit is contained in:
Jeremy Lakeman 2014-07-21 16:13:17 +09:30
parent 6c08c8d4a4
commit 5a38d2eb0c
3 changed files with 9 additions and 1 deletions

View File

@ -40,6 +40,7 @@ public class MeshMSMessage {
public final String text;
public final boolean isDelivered;
public final boolean isRead;
public final long timestamp;
public final Long ackOffset;
protected MeshMSMessage(int rowNumber,
@ -51,6 +52,7 @@ public class MeshMSMessage {
String text,
boolean delivered,
boolean read,
long timestamp,
Long ack_offset) throws ServalDInterfaceException
{
if (my_sid == null)
@ -72,6 +74,7 @@ public class MeshMSMessage {
this.text = text;
this.isDelivered = delivered;
this.isRead = read;
this.timestamp = timestamp;
this.ackOffset = ack_offset;
}

View File

@ -66,6 +66,7 @@ public class MeshMSMessageList {
.addColumn("text", String.class, JSONTokeniser.Narrow.ALLOW_NULL)
.addColumn("delivered", Boolean.class)
.addColumn("read", Boolean.class)
.addColumn("timestamp", Long.class)
.addColumn("ack_offset", Long.class, JSONTokeniser.Narrow.ALLOW_NULL);
}
@ -156,6 +157,7 @@ public class MeshMSMessageList {
(String)row.get("text"),
(Boolean)row.get("delivered"),
(Boolean)row.get("read"),
(Long)row.get("timestamp"),
(Long)row.get("ack_offset")
);
}

View File

@ -20,7 +20,6 @@
package org.servalproject.test;
import java.io.IOException;
import org.servalproject.servaldna.ServalDClient;
import org.servalproject.servaldna.ServalDInterfaceException;
import org.servalproject.servaldna.ServerControl;
@ -32,6 +31,8 @@ import org.servalproject.servaldna.meshms.MeshMSMessage;
import org.servalproject.servaldna.meshms.MeshMSMessageList;
import org.servalproject.servaldna.meshms.MeshMSStatus;
import java.io.IOException;
public class Meshms {
static void meshms_list_conversations(SubscriberId sid) throws ServalDInterfaceException, IOException, InterruptedException
@ -80,6 +81,7 @@ public class Meshms {
+ ", text=" + (msg.text == null ? null : msg.text.replace('\n', '.').replace(' ', '.'))
+ ", delivered=" + msg.isDelivered
+ ", read=" + msg.isRead
+ ", timestamp=" + msg.timestamp
+ ", ack_offset=" + msg.ackOffset
);
}
@ -110,6 +112,7 @@ public class Meshms {
+ ", text=" + (msg.text == null ? null : msg.text.replace('\n', '.').replace(' ', '.'))
+ ", delivered=" + msg.isDelivered
+ ", read=" + msg.isRead
+ ", timestamp=" + msg.timestamp
+ ", ack_offset=" + msg.ackOffset
);
}