use of de.pixart.messenger.entities.TransferablePlaceholder in project Pix-Art-Messenger by kriztan.
the class ConversationFragment method deleteFile.
private void deleteFile(Message message) {
if (activity.xmppConnectionService.getFileBackend().deleteFile(message)) {
message.setTransferable(new TransferablePlaceholder(Transferable.STATUS_DELETED));
activity.onConversationsListItemUpdated();
refresh();
}
}
use of de.pixart.messenger.entities.TransferablePlaceholder in project Pix-Art-Messenger by kriztan.
the class HttpDownloadConnection method cancel.
@Override
public void cancel() {
this.canceled = true;
mHttpConnectionManager.finishConnection(this);
if (message.isFileOrImage()) {
message.setTransferable(new TransferablePlaceholder(Transferable.STATUS_DELETED));
} else {
message.setTransferable(null);
}
mHttpConnectionManager.updateConversationUi(true);
}
use of de.pixart.messenger.entities.TransferablePlaceholder in project Pix-Art-Messenger by kriztan.
the class JingleConnection method cancel.
public void cancel() {
this.disconnectSocks5Connections();
if (this.transport != null && this.transport instanceof JingleInbandTransport) {
this.transport.disconnect();
}
this.sendCancel();
this.mJingleConnectionManager.finishConnection(this);
if (responding()) {
this.message.setTransferable(new TransferablePlaceholder(Transferable.STATUS_FAILED));
if (this.file != null) {
file.delete();
}
this.mJingleConnectionManager.updateConversationUi(true);
} else {
this.mXmppConnectionService.markMessage(this.message, Message.STATUS_SEND_FAILED);
this.message.setTransferable(null);
}
}
use of de.pixart.messenger.entities.TransferablePlaceholder in project Pix-Art-Messenger by kriztan.
the class JingleConnection method fail.
private void fail(String errorMessage) {
this.mJingleStatus = JINGLE_STATUS_FAILED;
this.disconnectSocks5Connections();
if (this.transport != null && this.transport instanceof JingleInbandTransport) {
this.transport.disconnect();
}
FileBackend.close(mFileInputStream);
FileBackend.close(mFileOutputStream);
if (this.message != null) {
if (responding()) {
this.message.setTransferable(new TransferablePlaceholder(Transferable.STATUS_FAILED));
if (this.file != null) {
file.delete();
}
this.mJingleConnectionManager.updateConversationUi(true);
} else {
this.mXmppConnectionService.markMessage(this.message, Message.STATUS_SEND_FAILED, errorMessage);
this.message.setTransferable(null);
}
}
this.mJingleConnectionManager.finishConnection(this);
}
use of de.pixart.messenger.entities.TransferablePlaceholder in project Pix-Art-Messenger by kriztan.
the class ConversationFragment method resendMessage.
public void resendMessage(final Message message) {
if (message.isFileOrImage()) {
DownloadableFile file = activity.xmppConnectionService.getFileBackend().getFile(message);
if (file.exists()) {
final Conversation conversation = message.getConversation();
final XmppConnection xmppConnection = conversation.getAccount().getXmppConnection();
if (!message.hasFileOnRemoteHost() && xmppConnection != null && !xmppConnection.getFeatures().httpUpload(message.getFileParams().size)) {
activity.selectPresence(conversation, () -> {
message.setCounterpart(conversation.getNextCounterpart());
activity.xmppConnectionService.resendFailedMessages(message);
new Handler().post(() -> {
int size = messageList.size();
this.binding.messagesView.setSelection(size - 1);
});
});
return;
}
} else {
Toast.makeText(activity, R.string.file_deleted, Toast.LENGTH_SHORT).show();
message.setTransferable(new TransferablePlaceholder(Transferable.STATUS_DELETED));
activity.onConversationsListItemUpdated();
refresh();
return;
}
}
activity.xmppConnectionService.resendFailedMessages(message);
new Handler().post(() -> {
int size = messageList.size();
this.binding.messagesView.setSelection(size - 1);
});
}
Aggregations