Adjust encoding
This commit is contained in:
parent
79f83babb3
commit
d2dbff173a
|
@ -138,12 +138,12 @@ public class MessageController {
|
|||
public void sendProvisioningMessage(@Auth Account source,
|
||||
@PathParam("destination") String destinationName,
|
||||
@Valid ProvisioningMessage message)
|
||||
throws RateLimitExceededException, InvalidWebsocketAddressException
|
||||
throws RateLimitExceededException, InvalidWebsocketAddressException, IOException
|
||||
{
|
||||
rateLimiters.getMessagesLimiter().validate(source.getNumber());
|
||||
|
||||
pushSender.getWebSocketSender().sendProvisioningMessage(new ProvisioningAddress(destinationName),
|
||||
message.getBody());
|
||||
Base64.decode(message.getBody()));
|
||||
}
|
||||
|
||||
private void sendLocalMessage(Account source,
|
||||
|
|
|
@ -30,8 +30,6 @@ import org.whispersystems.textsecuregcm.util.Constants;
|
|||
import org.whispersystems.textsecuregcm.websocket.ProvisioningAddress;
|
||||
import org.whispersystems.textsecuregcm.websocket.WebsocketAddress;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
|
||||
import static com.codahale.metrics.MetricRegistry.name;
|
||||
import static org.whispersystems.textsecuregcm.entities.MessageProtos.OutgoingMessageSignal;
|
||||
import static org.whispersystems.textsecuregcm.storage.PubSubProtos.PubSubMessage;
|
||||
|
@ -84,22 +82,18 @@ public class WebsocketSender {
|
|||
}
|
||||
}
|
||||
|
||||
public boolean sendProvisioningMessage(ProvisioningAddress address, String body) {
|
||||
try {
|
||||
PubSubMessage pubSubMessage = PubSubMessage.newBuilder()
|
||||
.setType(PubSubMessage.Type.DELIVER)
|
||||
.setContent(ByteString.copyFrom(body, "UTF-8"))
|
||||
.build();
|
||||
public boolean sendProvisioningMessage(ProvisioningAddress address, byte[] body) {
|
||||
PubSubMessage pubSubMessage = PubSubMessage.newBuilder()
|
||||
.setType(PubSubMessage.Type.DELIVER)
|
||||
.setContent(ByteString.copyFrom(body))
|
||||
.build();
|
||||
|
||||
if (pubSubManager.publish(address, pubSubMessage)) {
|
||||
provisioningOnlineMeter.mark();
|
||||
return true;
|
||||
} else {
|
||||
provisioningOfflineMeter.mark();
|
||||
return false;
|
||||
}
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
throw new AssertionError(e);
|
||||
if (pubSubManager.publish(address, pubSubMessage)) {
|
||||
provisioningOnlineMeter.mark();
|
||||
return true;
|
||||
} else {
|
||||
provisioningOfflineMeter.mark();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue