renamed HttpConnection to HttpDownloadConnection
This commit is contained in:
parent
ce79f4bbe3
commit
78aff1329f
|
@ -61,7 +61,7 @@ public class PgpEngine {
|
||||||
if (message.trusted()
|
if (message.trusted()
|
||||||
&& message.treatAsDownloadable() != Message.Decision.NEVER
|
&& message.treatAsDownloadable() != Message.Decision.NEVER
|
||||||
&& manager.getAutoAcceptFileSize() > 0) {
|
&& manager.getAutoAcceptFileSize() > 0) {
|
||||||
manager.createNewConnection(message);
|
manager.createNewDownloadConnection(message);
|
||||||
}
|
}
|
||||||
callback.success(message);
|
callback.success(message);
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,17 +24,17 @@ public class HttpConnectionManager extends AbstractConnectionManager {
|
||||||
super(service);
|
super(service);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<HttpConnection> connections = new CopyOnWriteArrayList<>();
|
private List<HttpDownloadConnection> downloadConnections = new CopyOnWriteArrayList<>();
|
||||||
private List<HttpUploadConnection> uploadConnections = new CopyOnWriteArrayList<>();
|
private List<HttpUploadConnection> uploadConnections = new CopyOnWriteArrayList<>();
|
||||||
|
|
||||||
public HttpConnection createNewConnection(Message message) {
|
public HttpDownloadConnection createNewDownloadConnection(Message message) {
|
||||||
return this.createNewConnection(message,false);
|
return this.createNewDownloadConnection(message, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public HttpConnection createNewConnection(Message message,boolean interactive) {
|
public HttpDownloadConnection createNewDownloadConnection(Message message, boolean interactive) {
|
||||||
HttpConnection connection = new HttpConnection(this);
|
HttpDownloadConnection connection = new HttpDownloadConnection(this);
|
||||||
connection.init(message,interactive);
|
connection.init(message,interactive);
|
||||||
this.connections.add(connection);
|
this.downloadConnections.add(connection);
|
||||||
return connection;
|
return connection;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,8 +45,8 @@ public class HttpConnectionManager extends AbstractConnectionManager {
|
||||||
return connection;
|
return connection;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void finishConnection(HttpConnection connection) {
|
public void finishConnection(HttpDownloadConnection connection) {
|
||||||
this.connections.remove(connection);
|
this.downloadConnections.remove(connection);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void finishUploadConnection(HttpUploadConnection httpUploadConnection) {
|
public void finishUploadConnection(HttpUploadConnection httpUploadConnection) {
|
||||||
|
|
|
@ -24,7 +24,7 @@ import eu.siacs.conversations.entities.Message;
|
||||||
import eu.siacs.conversations.services.XmppConnectionService;
|
import eu.siacs.conversations.services.XmppConnectionService;
|
||||||
import eu.siacs.conversations.utils.CryptoHelper;
|
import eu.siacs.conversations.utils.CryptoHelper;
|
||||||
|
|
||||||
public class HttpConnection implements Transferable {
|
public class HttpDownloadConnection implements Transferable {
|
||||||
|
|
||||||
private HttpConnectionManager mHttpConnectionManager;
|
private HttpConnectionManager mHttpConnectionManager;
|
||||||
private XmppConnectionService mXmppConnectionService;
|
private XmppConnectionService mXmppConnectionService;
|
||||||
|
@ -37,7 +37,7 @@ public class HttpConnection implements Transferable {
|
||||||
private int mProgress = 0;
|
private int mProgress = 0;
|
||||||
private long mLastGuiRefresh = 0;
|
private long mLastGuiRefresh = 0;
|
||||||
|
|
||||||
public HttpConnection(HttpConnectionManager manager) {
|
public HttpDownloadConnection(HttpConnectionManager manager) {
|
||||||
this.mHttpConnectionManager = manager;
|
this.mHttpConnectionManager = manager;
|
||||||
this.mXmppConnectionService = manager.getXmppConnectionService();
|
this.mXmppConnectionService = manager.getXmppConnectionService();
|
||||||
}
|
}
|
||||||
|
@ -138,8 +138,8 @@ public class HttpConnection implements Transferable {
|
||||||
size = retrieveFileSize();
|
size = retrieveFileSize();
|
||||||
} catch (SSLHandshakeException e) {
|
} catch (SSLHandshakeException e) {
|
||||||
changeStatus(STATUS_OFFER_CHECK_FILESIZE);
|
changeStatus(STATUS_OFFER_CHECK_FILESIZE);
|
||||||
HttpConnection.this.acceptedAutomatically = false;
|
HttpDownloadConnection.this.acceptedAutomatically = false;
|
||||||
HttpConnection.this.mXmppConnectionService.getNotificationService().push(message);
|
HttpDownloadConnection.this.mXmppConnectionService.getNotificationService().push(message);
|
||||||
return;
|
return;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Log.d(Config.LOGTAG, "io exception in http file size checker: " + e.getMessage());
|
Log.d(Config.LOGTAG, "io exception in http file size checker: " + e.getMessage());
|
||||||
|
@ -151,12 +151,12 @@ public class HttpConnection implements Transferable {
|
||||||
}
|
}
|
||||||
file.setExpectedSize(size);
|
file.setExpectedSize(size);
|
||||||
if (size <= mHttpConnectionManager.getAutoAcceptFileSize()) {
|
if (size <= mHttpConnectionManager.getAutoAcceptFileSize()) {
|
||||||
HttpConnection.this.acceptedAutomatically = true;
|
HttpDownloadConnection.this.acceptedAutomatically = true;
|
||||||
new Thread(new FileDownloader(interactive)).start();
|
new Thread(new FileDownloader(interactive)).start();
|
||||||
} else {
|
} else {
|
||||||
changeStatus(STATUS_OFFER);
|
changeStatus(STATUS_OFFER);
|
||||||
HttpConnection.this.acceptedAutomatically = false;
|
HttpDownloadConnection.this.acceptedAutomatically = false;
|
||||||
HttpConnection.this.mXmppConnectionService.getNotificationService().push(message);
|
HttpDownloadConnection.this.mXmppConnectionService.getNotificationService().push(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -362,7 +362,7 @@ public class MessageParser extends AbstractParser implements
|
||||||
}
|
}
|
||||||
final HttpConnectionManager manager = this.mXmppConnectionService.getHttpConnectionManager();
|
final HttpConnectionManager manager = this.mXmppConnectionService.getHttpConnectionManager();
|
||||||
if (message.trusted() && message.treatAsDownloadable() != Message.Decision.NEVER && manager.getAutoAcceptFileSize() > 0) {
|
if (message.trusted() && message.treatAsDownloadable() != Message.Decision.NEVER && manager.getAutoAcceptFileSize() > 0) {
|
||||||
manager.createNewConnection(message);
|
manager.createNewDownloadConnection(message);
|
||||||
} else if (!message.isRead()) {
|
} else if (!message.isRead()) {
|
||||||
mXmppConnectionService.getNotificationService().push(message);
|
mXmppConnectionService.getNotificationService().push(message);
|
||||||
}
|
}
|
||||||
|
|
|
@ -557,7 +557,7 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
|
||||||
|
|
||||||
private void downloadFile(Message message) {
|
private void downloadFile(Message message) {
|
||||||
activity.xmppConnectionService.getHttpConnectionManager()
|
activity.xmppConnectionService.getHttpConnectionManager()
|
||||||
.createNewConnection(message);
|
.createNewDownloadConnection(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cancelTransmission(Message message) {
|
private void cancelTransmission(Message message) {
|
||||||
|
|
|
@ -543,7 +543,7 @@ public class MessageAdapter extends ArrayAdapter<Message> {
|
||||||
Toast.LENGTH_SHORT).show();
|
Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
} else if (message.treatAsDownloadable() != Message.Decision.NEVER) {
|
} else if (message.treatAsDownloadable() != Message.Decision.NEVER) {
|
||||||
activity.xmppConnectionService.getHttpConnectionManager().createNewConnection(message);
|
activity.xmppConnectionService.getHttpConnectionManager().createNewDownloadConnection(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue