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
1
.classpath
Normal file → Executable file
1
.classpath
Normal file → Executable file
@ -3,7 +3,6 @@
|
|||||||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
<attribute name="module" value="true"/>
|
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
|
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
|
||||||
|
0
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file → Executable file
0
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file → Executable file
0
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file → Executable file
0
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file → Executable file
0
.github/PULL_REQUEST_TEMPLATE/bugfix.md
vendored
Normal file → Executable file
0
.github/PULL_REQUEST_TEMPLATE/bugfix.md
vendored
Normal file → Executable file
0
.github/PULL_REQUEST_TEMPLATE/feature_integration.md
vendored
Normal file → Executable file
0
.github/PULL_REQUEST_TEMPLATE/feature_integration.md
vendored
Normal file → Executable file
0
.github/PULL_REQUEST_TEMPLATE/javadoc_upgrade.md
vendored
Normal file → Executable file
0
.github/PULL_REQUEST_TEMPLATE/javadoc_upgrade.md
vendored
Normal file → Executable file
0
.github/workflows/maven.yml
vendored
Normal file → Executable file
0
.github/workflows/maven.yml
vendored
Normal file → Executable file
0
.github/workflows/stale.yml
vendored
Normal file → Executable file
0
.github/workflows/stale.yml
vendored
Normal file → Executable file
0
.gitignore
vendored
Normal file → Executable file
0
.gitignore
vendored
Normal file → Executable file
0
.settings/org.eclipse.core.resources.prefs
Normal file → Executable file
0
.settings/org.eclipse.core.resources.prefs
Normal file → Executable file
0
.settings/org.eclipse.jdt.core.prefs
Normal file → Executable file
0
.settings/org.eclipse.jdt.core.prefs
Normal file → Executable file
0
.settings/org.eclipse.jdt.ui.prefs
Normal file → Executable file
0
.settings/org.eclipse.jdt.ui.prefs
Normal file → Executable file
0
.settings/org.eclipse.jpt.core.prefs
Normal file → Executable file
0
.settings/org.eclipse.jpt.core.prefs
Normal file → Executable file
0
.settings/org.eclipse.m2e.core.prefs
Normal file → Executable file
0
.settings/org.eclipse.m2e.core.prefs
Normal file → Executable file
0
.settings/org.eclipse.wst.common.project.facet.core.prefs.xml
Normal file → Executable file
0
.settings/org.eclipse.wst.common.project.facet.core.prefs.xml
Normal file → Executable file
0
.settings/org.eclipse.wst.common.project.facet.core.xml
Normal file → Executable file
0
.settings/org.eclipse.wst.common.project.facet.core.xml
Normal file → Executable file
0
.settings/org.hibernate.eclipse.console.prefs
Normal file → Executable file
0
.settings/org.hibernate.eclipse.console.prefs
Normal file → Executable file
0
CODE_OF_CONDUCT.md
Normal file → Executable file
0
CODE_OF_CONDUCT.md
Normal file → Executable file
0
CONTRIBUTING.md
Normal file → Executable file
0
CONTRIBUTING.md
Normal file → Executable file
0
src/main/java/envoy/server/Startup.java
Normal file → Executable file
0
src/main/java/envoy/server/Startup.java
Normal file → Executable file
0
src/main/java/envoy/server/data/ConfigItem.java
Normal file → Executable file
0
src/main/java/envoy/server/data/ConfigItem.java
Normal file → Executable file
17
src/main/java/envoy/server/data/Message.java
Normal file → Executable file
17
src/main/java/envoy/server/data/Message.java
Normal file → Executable file
@ -47,9 +47,10 @@ public class Message {
|
|||||||
@Temporal(TemporalType.TIMESTAMP)
|
@Temporal(TemporalType.TIMESTAMP)
|
||||||
private Date readDate;
|
private Date readDate;
|
||||||
|
|
||||||
private envoy.data.Message.MessageStatus status;
|
|
||||||
private String text;
|
private String text;
|
||||||
|
private envoy.data.Message.MessageStatus status;
|
||||||
private byte[] attachment;
|
private byte[] attachment;
|
||||||
|
private boolean forwarded;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The constructor for a database object.
|
* The constructor for a database object.
|
||||||
@ -75,6 +76,7 @@ public class Message {
|
|||||||
readDate = message.getReadDate();
|
readDate = message.getReadDate();
|
||||||
sender = persMan.getUserById(message.getSenderId());
|
sender = persMan.getUserById(message.getSenderId());
|
||||||
recipient = persMan.getUserById(message.getRecipientId());
|
recipient = persMan.getUserById(message.getRecipientId());
|
||||||
|
forwarded = message.isForwarded();
|
||||||
// TODO: attachment = message.getAttachment().toByteArray();DOES NOT WORK YET
|
// 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)
|
envoy.data.Message message = new MessageBuilder(sender.getId(), recipient.getId(), id).setText(text)
|
||||||
.setDate(creationDate)
|
.setDate(creationDate)
|
||||||
.setStatus(status)
|
.setStatus(status)
|
||||||
|
.setForwarded(forwarded)
|
||||||
.build();
|
.build();
|
||||||
message.setReceivedDate(receivedDate);
|
message.setReceivedDate(receivedDate);
|
||||||
message.setReadDate(readDate);
|
message.setReadDate(readDate);
|
||||||
@ -210,4 +213,16 @@ public class Message {
|
|||||||
* @since Envoy Server Standalone v0.1-alpha
|
* @since Envoy Server Standalone v0.1-alpha
|
||||||
*/
|
*/
|
||||||
public void setAttachment(byte[] attachment) { this.attachment = attachment; }
|
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; }
|
||||||
}
|
}
|
||||||
|
0
src/main/java/envoy/server/data/PersistenceManager.java
Normal file → Executable file
0
src/main/java/envoy/server/data/PersistenceManager.java
Normal file → Executable file
5
src/main/java/envoy/server/data/User.java
Normal file → Executable file
5
src/main/java/envoy/server/data/User.java
Normal file → Executable file
@ -46,15 +46,14 @@ public class User {
|
|||||||
private List<User> contacts;
|
private List<User> contacts;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an instance of @link{User}.
|
* Creates an instance of {@link User}.
|
||||||
* Solely used for JPA/ Hibernate
|
|
||||||
*
|
*
|
||||||
* @since Envoy Server Standalone v0.1-alpha
|
* @since Envoy Server Standalone v0.1-alpha
|
||||||
*/
|
*/
|
||||||
public User() {}
|
public User() {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an instance of @link{User}.
|
* Creates an instance of {@link User}.
|
||||||
*
|
*
|
||||||
* @param user the {@link envoy.data.User} to convert
|
* @param user the {@link envoy.data.User} to convert
|
||||||
* @since Envoy Server Standalone v0.1-alpha
|
* @since Envoy Server Standalone v0.1-alpha
|
||||||
|
0
src/main/java/envoy/server/data/package-info.java
Normal file → Executable file
0
src/main/java/envoy/server/data/package-info.java
Normal file → Executable file
0
src/main/java/envoy/server/net/ConnectionManager.java
Normal file → Executable file
0
src/main/java/envoy/server/net/ConnectionManager.java
Normal file → Executable file
0
src/main/java/envoy/server/net/ObjectMessageProcessor.java
Normal file → Executable file
0
src/main/java/envoy/server/net/ObjectMessageProcessor.java
Normal file → Executable file
5
src/main/java/envoy/server/net/ObjectMessageReader.java
Normal file → Executable file
5
src/main/java/envoy/server/net/ObjectMessageReader.java
Normal file → Executable file
@ -5,10 +5,7 @@ import java.nio.ByteBuffer;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.jenkov.nioserver.IMessageReader;
|
import com.jenkov.nioserver.*;
|
||||||
import com.jenkov.nioserver.Message;
|
|
||||||
import com.jenkov.nioserver.MessageBuffer;
|
|
||||||
import com.jenkov.nioserver.Socket;
|
|
||||||
|
|
||||||
import envoy.util.SerializationUtils;
|
import envoy.util.SerializationUtils;
|
||||||
|
|
||||||
|
0
src/main/java/envoy/server/net/ObjectWriteProxy.java
Normal file → Executable file
0
src/main/java/envoy/server/net/ObjectWriteProxy.java
Normal file → Executable file
0
src/main/java/envoy/server/net/package-info.java
Normal file → Executable file
0
src/main/java/envoy/server/net/package-info.java
Normal file → Executable file
0
src/main/java/envoy/server/package-info.java
Normal file → Executable file
0
src/main/java/envoy/server/package-info.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/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/LoginCredentialProcessor.java
Normal file → Executable file
0
src/main/java/envoy/server/processors/LoginCredentialProcessor.java
Normal file → Executable file
0
src/main/java/envoy/server/processors/MessageProcessor.java
Normal file → Executable file
0
src/main/java/envoy/server/processors/MessageProcessor.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/ObjectProcessor.java
Normal file → Executable file
0
src/main/java/envoy/server/processors/ObjectProcessor.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
0
src/main/java/envoy/server/processors/package-info.java
Normal file → Executable file
0
src/main/java/envoy/server/processors/package-info.java
Normal file → Executable file
0
src/main/java/module-info.java
Normal file → Executable file
0
src/main/java/module-info.java
Normal file → Executable file
0
src/main/resources/META-INF/persistence.xml
Normal file → Executable file
0
src/main/resources/META-INF/persistence.xml
Normal file → Executable file
Reference in New Issue
Block a user