diff options
author | iNPUTmice <daniel@gultsch.de> | 2014-10-24 13:29:18 +0200 |
---|---|---|
committer | iNPUTmice <daniel@gultsch.de> | 2014-10-24 13:29:18 +0200 |
commit | cbc3d9bd6f275984b390eb4dae48f8eed669fe7a (patch) | |
tree | 41833ad63e232ef255566b964e8e770520c4efbf /src/eu/siacs/conversations/http/HttpConnection.java | |
parent | d73a77643d7923cae0789c5ed9f6a2a4cf41385f (diff) |
notify only after image has been received over http. introduced mini grace for catching up with SM or offline messages
Diffstat (limited to 'src/eu/siacs/conversations/http/HttpConnection.java')
-rw-r--r-- | src/eu/siacs/conversations/http/HttpConnection.java | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/eu/siacs/conversations/http/HttpConnection.java b/src/eu/siacs/conversations/http/HttpConnection.java index b8ce5ed2..9b04decc 100644 --- a/src/eu/siacs/conversations/http/HttpConnection.java +++ b/src/eu/siacs/conversations/http/HttpConnection.java @@ -36,6 +36,7 @@ public class HttpConnection implements Downloadable { private Message message; private DownloadableFile file; private int mStatus = Downloadable.STATUS_UNKNOWN; + private boolean acceptedAutomatically = false; public HttpConnection(HttpConnectionManager manager) { this.mHttpConnectionManager = manager; @@ -99,6 +100,9 @@ public class HttpConnection implements Downloadable { message.setDownloadable(null); mHttpConnectionManager.finishConnection(this); mXmppConnectionService.updateConversationUi(); + if (acceptedAutomatically) { + mXmppConnectionService.getNotificationService().push(message); + } } private void changeStatus(int status) { @@ -151,6 +155,8 @@ public class HttpConnection implements Downloadable { size = retrieveFileSize(); } catch (SSLHandshakeException e) { changeStatus(STATUS_OFFER_CHECK_FILESIZE); + HttpConnection.this.acceptedAutomatically = false; + HttpConnection.this.mXmppConnectionService.getNotificationService().push(message); return; } catch (IOException e) { cancel(); @@ -158,9 +164,12 @@ public class HttpConnection implements Downloadable { } file.setExpectedSize(size); if (size <= mHttpConnectionManager.getAutoAcceptFileSize()) { + HttpConnection.this.acceptedAutomatically = true; new Thread(new FileDownloader(interactive)).start(); } else { changeStatus(STATUS_OFFER); + HttpConnection.this.acceptedAutomatically = false; + HttpConnection.this.mXmppConnectionService.getNotificationService().push(message); } } |