Add federation support for attachment retrieval.

This commit is contained in:
Moxie Marlinspike
2013-10-19 18:16:11 -07:00
parent 246cd10454
commit 51b9affe90
3 changed files with 21 additions and 6 deletions

View File

@@ -172,9 +172,14 @@ public class PushServiceSocket {
return new Gson().fromJson(response.second, AttachmentKey.class).getId();
}
public File retrieveAttachment(long attachmentId) throws IOException {
Pair<String, String> response = makeRequestForResponseHeader(String.format(ATTACHMENT_PATH, String.valueOf(attachmentId)),
"GET", null, "Content-Location");
public File retrieveAttachment(String relay, long attachmentId) throws IOException {
String path = String.format(ATTACHMENT_PATH, String.valueOf(attachmentId));
if (relay != null) {
path = path + "?relay=" + relay;
}
Pair<String, String> response = makeRequestForResponseHeader(path, "GET", null, "Content-Location");
Log.w("PushServiceSocket", "Attachment: " + attachmentId + " is at: " + response.first);