Added database support to forward messages (#30)
* Added server support for forwarding messages * added newline at EOF for any file not having one at its end
This commit is contained in:
parent
c1dd4fa9fb
commit
9020598335
|
@ -3,7 +3,6 @@
|
|||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
<attribute name="module" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
|
||||
|
|
|
@ -47,9 +47,10 @@ public class Message {
|
|||
@Temporal(TemporalType.TIMESTAMP)
|
||||
private Date readDate;
|
||||
|
||||
private envoy.data.Message.MessageStatus status;
|
||||
private String text;
|
||||
private envoy.data.Message.MessageStatus status;
|
||||
private byte[] attachment;
|
||||
private boolean forwarded;
|
||||
|
||||
/**
|
||||
* The constructor for a database object.
|
||||
|
@ -75,6 +76,7 @@ public class Message {
|
|||
readDate = message.getReadDate();
|
||||
sender = persMan.getUserById(message.getSenderId());
|
||||
recipient = persMan.getUserById(message.getRecipientId());
|
||||
forwarded = message.isForwarded();
|
||||
// TODO: attachment = message.getAttachment().toByteArray();DOES NOT WORK YET
|
||||
}
|
||||
|
||||
|
@ -90,6 +92,7 @@ public class Message {
|
|||
envoy.data.Message message = new MessageBuilder(sender.getId(), recipient.getId(), id).setText(text)
|
||||
.setDate(creationDate)
|
||||
.setStatus(status)
|
||||
.setForwarded(forwarded)
|
||||
.build();
|
||||
message.setReceivedDate(receivedDate);
|
||||
message.setReadDate(readDate);
|
||||
|
@ -210,4 +213,16 @@ public class Message {
|
|||
* @since Envoy Server Standalone v0.1-alpha
|
||||
*/
|
||||
public void setAttachment(byte[] attachment) { this.attachment = attachment; }
|
||||
|
||||
/**
|
||||
* @return whether this message is a forwarded message
|
||||
* @since Envoy Server Standalone v0.1-alpha
|
||||
*/
|
||||
public boolean isForwarded() { return forwarded; }
|
||||
|
||||
/**
|
||||
* @param forwarded this message should be a forwarded message.
|
||||
* @since Envoy Server Standalone v0.1-alpha
|
||||
*/
|
||||
public void setForwarded(boolean forwarded) { this.forwarded = forwarded; }
|
||||
}
|
||||
|
|
|
@ -46,15 +46,14 @@ public class User {
|
|||
private List<User> contacts;
|
||||
|
||||
/**
|
||||
* Creates an instance of @link{User}.
|
||||
* Solely used for JPA/ Hibernate
|
||||
* Creates an instance of {@link User}.
|
||||
*
|
||||
* @since Envoy Server Standalone v0.1-alpha
|
||||
*/
|
||||
public User() {}
|
||||
|
||||
/**
|
||||
* Creates an instance of @link{User}.
|
||||
* Creates an instance of {@link User}.
|
||||
*
|
||||
* @param user the {@link envoy.data.User} to convert
|
||||
* @since Envoy Server Standalone v0.1-alpha
|
||||
|
|
|
@ -5,10 +5,7 @@ import java.nio.ByteBuffer;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.jenkov.nioserver.IMessageReader;
|
||||
import com.jenkov.nioserver.Message;
|
||||
import com.jenkov.nioserver.MessageBuffer;
|
||||
import com.jenkov.nioserver.Socket;
|
||||
import com.jenkov.nioserver.*;
|
||||
|
||||
import envoy.util.SerializationUtils;
|
||||
|
||||
|
|
0
src/main/java/envoy/server/processors/ContactOperationProcessor.java
Normal file → Executable file
0
src/main/java/envoy/server/processors/ContactOperationProcessor.java
Normal file → Executable file
0
src/main/java/envoy/server/processors/ContactsRequestEventProcessor.java
Normal file → Executable file
0
src/main/java/envoy/server/processors/ContactsRequestEventProcessor.java
Normal file → Executable file
0
src/main/java/envoy/server/processors/IdGeneratorRequestProcessor.java
Normal file → Executable file
0
src/main/java/envoy/server/processors/IdGeneratorRequestProcessor.java
Normal file → Executable file
0
src/main/java/envoy/server/processors/MessageStatusChangeProcessor.java
Normal file → Executable file
0
src/main/java/envoy/server/processors/MessageStatusChangeProcessor.java
Normal file → Executable file
0
src/main/java/envoy/server/processors/UserStatusChangeProcessor.java
Normal file → Executable file
0
src/main/java/envoy/server/processors/UserStatusChangeProcessor.java
Normal file → Executable file
Reference in New Issue