Enable TextSecure universal transport.

This commit is contained in:
Moxie Marlinspike
2013-07-12 17:40:41 -07:00
parent d7070e7ecf
commit 53803630d4
8 changed files with 126 additions and 149 deletions

View File

@@ -3,23 +3,25 @@ package org.whispersystems.textsecure.push;
import java.util.LinkedList;
import java.util.List;
public class OutgoingGcmMessage {
public class OutgoingPushMessage {
private List<String> destinations;
private String messageText;
private List<String> attachments;
public OutgoingGcmMessage(List<String> destinations, String messageText, List<String> attachments) {
public OutgoingPushMessage(List<String> destinations, String messageText,
List<String> attachments)
{
this.destinations = destinations;
this.messageText = messageText;
this.attachments = attachments;
}
public OutgoingGcmMessage(String destination, String messageText) {
public OutgoingPushMessage(String destination, String messageText) {
this.destinations = new LinkedList<String>();
this.destinations.add(destination);
this.messageText = messageText;
this.attachments = new LinkedList<String>();
this.messageText = messageText;
this.destinations.add(destination);
}
public List<String> getDestinations() {

View File

@@ -1,7 +1,6 @@
package org.whispersystems.textsecure.push;
import android.content.Context;
import android.content.res.AssetManager;
import android.util.Base64;
import android.util.Log;
@@ -72,7 +71,7 @@ public class PushServiceSocket {
public void sendMessage(String recipient, String messageText)
throws IOException, RateLimitException
{
OutgoingGcmMessage message = new OutgoingGcmMessage(recipient, messageText);
OutgoingPushMessage message = new OutgoingPushMessage(recipient, messageText);
String responseText = makeRequest(MESSAGE_PATH, "POST", new Gson().toJson(message));
GcmMessageResponse response = new Gson().fromJson(responseText, GcmMessageResponse.class);