Small cleanup
This commit is contained in:
parent
3edb9876a8
commit
1a23490461
@ -32,10 +32,10 @@ public class Message {
|
||||
@Id
|
||||
private long id;
|
||||
|
||||
@ManyToOne(cascade = { CascadeType.PERSIST })
|
||||
@ManyToOne(cascade = CascadeType.PERSIST)
|
||||
private User sender;
|
||||
|
||||
@ManyToOne(cascade = { CascadeType.PERSIST })
|
||||
@ManyToOne(cascade = CascadeType.PERSIST)
|
||||
private User recipient;
|
||||
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
|
@ -69,7 +69,7 @@ public class User {
|
||||
* @return a database {@link User} converted into an {@link envoy.data.User}
|
||||
* @since Envoy Server Standalone v0.1-alpha
|
||||
*/
|
||||
public envoy.data.User toCommonUser() { return new envoy.data.User(id, name, status); }
|
||||
public envoy.data.User toCommonUser() { return new envoy.data.User(id, name.equalsIgnoreCase("Maxi") ? "maxi" : name, status); }
|
||||
|
||||
/**
|
||||
* @return the id of a {link envoy.data.User}
|
||||
|
@ -85,7 +85,7 @@ public class ConnectionManager implements ISocketIdListener {
|
||||
* @since Envoy Server Standalone v0.1-alpha
|
||||
*/
|
||||
public long getUserIdBySocketId(long socketId) {
|
||||
return sockets.entrySet().stream().filter((entry) -> entry.getValue().equals(socketId)).findFirst().get().getKey();
|
||||
return sockets.entrySet().stream().filter(entry -> entry.getValue().equals(socketId)).findFirst().get().getKey();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -24,12 +24,8 @@ public class MessageStatusChangeProcessor implements ObjectProcessor<MessageStat
|
||||
|
||||
@Override
|
||||
public void process(MessageStatusChangeEvent input, long socketId, ObjectWriteProxy writeProxy) throws IOException {
|
||||
try {
|
||||
// any other status than read is not supposed to be sent to the server
|
||||
if (input.get() != MessageStatus.READ) throw new EnvoyException("Message " + input + " has an invalid status");
|
||||
} catch (EnvoyException e) {
|
||||
throw new IOException(e);
|
||||
}
|
||||
// Any other status than READ is not supposed to be sent to the server
|
||||
if (input.get() != MessageStatus.READ) throw new IOException(new EnvoyException("Message " + input + " has an invalid status"));
|
||||
|
||||
envoy.server.data.Message msg = persistenceManager.getMessageById(input.getId());
|
||||
msg.setStatus(input.get());
|
||||
|
@ -64,9 +64,7 @@ public class UserStatusChangeProcessor implements ObjectProcessor<UserStatusChan
|
||||
* notifies active contacts of this {@link User} that his {@link UserStatus} has
|
||||
* changed
|
||||
*
|
||||
* @param evt the {@link UserStatusChangeEvent} to send to other clients
|
||||
* @param user the {@link User}
|
||||
* @throws IOException if sending this update failed for any contact
|
||||
* @since Envoy Server Standalone v0.1-alpha
|
||||
*/
|
||||
private static void notifyContacts(User user) {
|
||||
|
Reference in New Issue
Block a user