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