mirror of
https://github.com/signalapp/Signal-Server
synced 2026-04-26 01:18:03 +01:00
Fix StoredMessages calls (now all api calls have at least been tested on a running server...)
This commit is contained in:
@@ -106,7 +106,7 @@ public class PushSender {
|
||||
apnSender.sendMessage(account.getApnRegistrationId(), outgoingMessage);
|
||||
}
|
||||
|
||||
private void storeFetchedMessage(Account account, EncryptedOutgoingMessage outgoingMessage) {
|
||||
private void storeFetchedMessage(Account account, EncryptedOutgoingMessage outgoingMessage) throws IOException {
|
||||
storedMessageManager.storeMessage(account, outgoingMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,13 +18,20 @@ package org.whispersystems.textsecuregcm.storage;
|
||||
|
||||
import org.whispersystems.textsecuregcm.entities.EncryptedOutgoingMessage;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
public class StoredMessageManager {
|
||||
StoredMessages storedMessages;
|
||||
public StoredMessageManager(StoredMessages storedMessages) {
|
||||
this.storedMessages = storedMessages;
|
||||
}
|
||||
|
||||
public void storeMessage(Account account, EncryptedOutgoingMessage outgoingMessage) {
|
||||
storedMessages.insert(account.getId(), outgoingMessage);
|
||||
public void storeMessage(Account account, EncryptedOutgoingMessage outgoingMessage) throws IOException {
|
||||
storedMessages.insert(account.getId(), outgoingMessage.serialize());
|
||||
}
|
||||
|
||||
public List<String> getStoredMessage(Account account) {
|
||||
return storedMessages.getMessagesForAccountId(account.getId());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,9 +25,9 @@ import java.util.List;
|
||||
|
||||
public interface StoredMessages {
|
||||
|
||||
@SqlUpdate("INSERT INTO stored_messages (destination_id, encrypted_message) VALUES :destination_id, :encrypted_message")
|
||||
void insert(@Bind("destination_id") long destinationAccountId, @Bind("encrypted_message") EncryptedOutgoingMessage encryptedOutgoingMessage);
|
||||
@SqlUpdate("INSERT INTO stored_messages (destination_id, encrypted_message) VALUES (:destination_id, :encrypted_message)")
|
||||
void insert(@Bind("destination_id") long destinationAccountId, @Bind("encrypted_message") String encryptedOutgoingMessage);
|
||||
|
||||
@SqlQuery("SELECT encrypted_message FROM stored_messages WHERE destination_id = :account_id")
|
||||
List<EncryptedOutgoingMessage> getMessagesForAccountId(@Bind("account_id") long accountId);
|
||||
List<String> getMessagesForAccountId(@Bind("account_id") long accountId);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user