Compare commits

..

No commits in common. "dc32071529acb565321a8d23ebd2c2a3b8184a8f" and "7fea10f4dc996ce6d7a92592484a9b001c200416" have entirely different histories.

2 changed files with 7 additions and 2 deletions

View file

@ -248,7 +248,13 @@ public class DatabaseController {
// Handle messages containing a file // Handle messages containing a file
String filePath = "NULL"; String filePath = "NULL";
if (message instanceof FileMessage) { if (message instanceof FileMessage) {
filePath = "'" + ((FileMessage) message).getPath() + "'"; try {
filePath = "'" + ((FileMessage) message).storeFile() + "'";
} catch (IOException e) {
Log.e(getClass().getSimpleName(), "Error while saving the file", e);
errorCallback.onError(e);
return;
}
} }
String recipientId = message.getRecipient().id; String recipientId = message.getRecipient().id;

View file

@ -66,7 +66,6 @@ public class PeerUser extends User implements Comparable<PeerUser> {
"Sending file message to " + this.getUsername() + " / " + this.getId() + ": " + msg); "Sending file message to " + this.getUsername() + " / " + this.getId() + ": " + msg);
try { try {
final FileMessage message = new FileMessage(CurrentUser.getInstance(), this, new Date(), msg, file.getPath()); final FileMessage message = new FileMessage(CurrentUser.getInstance(), this, new Date(), msg, file.getPath());
message.storeFile();
connection.send(message, () -> history.addMessage(message, errorCallback), errorCallback); connection.send(message, () -> history.addMessage(message, errorCallback), errorCallback);
} catch (IOException e) { } catch (IOException e) {
Log.e(this.getClass().getSimpleName(), "Could not send message: error while opening file", e); Log.e(this.getClass().getSimpleName(), "Could not send message: error while opening file", e);