show attach button in conferences when http upload is available
This commit is contained in:
parent
9eb9a52205
commit
7e11570f2c
|
@ -44,6 +44,10 @@ public class Account extends AbstractEntity {
|
|||
public static final int OPTION_REGISTER = 2;
|
||||
public static final int OPTION_USECOMPRESSION = 3;
|
||||
|
||||
public boolean httpUploadAvailable() {
|
||||
return xmppConnection != null && xmppConnection.getFeatures().httpUpload();
|
||||
}
|
||||
|
||||
public static enum State {
|
||||
DISABLED,
|
||||
OFFLINE,
|
||||
|
|
|
@ -145,6 +145,7 @@ public class HttpUploadConnection implements Downloadable {
|
|||
Message.ImageParams params = message.getImageParams();
|
||||
message.setBody(mGetUrl.toString()+"|"+String.valueOf(params.size)+"|"+String.valueOf(params.width)+"|"+String.valueOf(params.height));
|
||||
message.setDownloadable(null);
|
||||
message.setCounterpart(message.getConversation().getJid().toBareJid());
|
||||
mXmppConnectionService.resendMessage(message);
|
||||
} else {
|
||||
fail();
|
||||
|
|
|
@ -692,7 +692,7 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
|
|||
if (account.getStatus() == Account.State.ONLINE
|
||||
&& account.getXmppConnection() != null) {
|
||||
if (message.needsUploading()) {
|
||||
if (message.getCounterpart() != null) {
|
||||
if (message.getCounterpart() != null || account.httpUploadAvailable()) {
|
||||
if (message.getEncryption() == Message.ENCRYPTION_OTR) {
|
||||
if (!conv.hasValidOtrSession()) {
|
||||
conv.startOtrSession(message.getCounterpart().getResourcepart(),true);
|
||||
|
@ -834,8 +834,7 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
|
|||
} else if (message.needsUploading()) {
|
||||
Contact contact = message.getConversation().getContact();
|
||||
Presences presences = contact.getPresences();
|
||||
if ((message.getCounterpart() != null)
|
||||
&& (presences.has(message.getCounterpart().getResourcepart()))) {
|
||||
if (account.httpUploadAvailable() || (message.getCounterpart() != null && presences.has(message.getCounterpart().getResourcepart()))) {
|
||||
this.sendFileMessage(message);
|
||||
} else {
|
||||
if (presences.size() == 1) {
|
||||
|
|
|
@ -35,6 +35,7 @@ import java.util.Iterator;
|
|||
import java.util.List;
|
||||
|
||||
import eu.siacs.conversations.R;
|
||||
import eu.siacs.conversations.entities.Account;
|
||||
import eu.siacs.conversations.entities.Blockable;
|
||||
import eu.siacs.conversations.entities.Contact;
|
||||
import eu.siacs.conversations.entities.Conversation;
|
||||
|
@ -382,7 +383,7 @@ public class ConversationActivity extends XmppActivity
|
|||
}
|
||||
if (this.getSelectedConversation().getMode() == Conversation.MODE_MULTI) {
|
||||
menuContactDetails.setVisible(false);
|
||||
menuAttach.setVisible(false);
|
||||
menuAttach.setVisible(getSelectedConversation().getAccount().httpUploadAvailable());
|
||||
menuInviteContact.setVisible(getSelectedConversation().getMucOptions().canInvite());
|
||||
} else {
|
||||
menuMucDetails.setVisible(false);
|
||||
|
@ -398,6 +399,8 @@ public class ConversationActivity extends XmppActivity
|
|||
}
|
||||
|
||||
private void selectPresenceToAttachFile(final int attachmentChoice, final int encryption) {
|
||||
final Conversation conversation = getSelectedConversation();
|
||||
final Account account = conversation.getAccount();
|
||||
final OnPresenceSelected callback = new OnPresenceSelected() {
|
||||
|
||||
@Override
|
||||
|
@ -449,11 +452,11 @@ public class ConversationActivity extends XmppActivity
|
|||
}
|
||||
}
|
||||
};
|
||||
if (attachmentChoice == ATTACHMENT_CHOICE_LOCATION && encryption != Message.ENCRYPTION_OTR) {
|
||||
getSelectedConversation().setNextCounterpart(null);
|
||||
if ((account.httpUploadAvailable() || attachmentChoice == ATTACHMENT_CHOICE_LOCATION) && encryption != Message.ENCRYPTION_OTR) {
|
||||
conversation.setNextCounterpart(null);
|
||||
callback.onPresenceSelected();
|
||||
} else {
|
||||
selectPresence(getSelectedConversation(),callback);
|
||||
selectPresence(conversation,callback);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue