diff options
Diffstat (limited to 'src/main/java/de/thedevstack/conversationsplus/services/XmppConnectionService.java')
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/services/XmppConnectionService.java | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/main/java/de/thedevstack/conversationsplus/services/XmppConnectionService.java b/src/main/java/de/thedevstack/conversationsplus/services/XmppConnectionService.java index 6e07f49c..d92401ba 100644 --- a/src/main/java/de/thedevstack/conversationsplus/services/XmppConnectionService.java +++ b/src/main/java/de/thedevstack/conversationsplus/services/XmppConnectionService.java @@ -818,8 +818,7 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa private void sendFileMessage(final Message message, final boolean delay) { Logging.d(Config.LOGTAG, "send file message"); final Account account = message.getConversation().getAccount(); - final XmppConnection connection = account.getXmppConnection(); - if (connection != null && connection.getFeatures().httpUpload()) { + if (account.httpUploadAvailable(FileBackend.getFile(message,false).getSize())) { mHttpConnectionManager.createNewUploadConnection(message, delay); } else { mJingleConnectionManager.createNewConnection(message); @@ -856,7 +855,8 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa switch (message.getEncryption()) { case Message.ENCRYPTION_NONE: if (message.needsUploading()) { - if (account.httpUploadAvailable() || message.fixCounterpart()) { + if (account.httpUploadAvailable(FileBackend.getFile(message,false).getSize()) + || message.fixCounterpart()) { this.sendFileMessage(message, delay); } else { break; @@ -868,7 +868,8 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa case Message.ENCRYPTION_PGP: case Message.ENCRYPTION_DECRYPTED: if (message.needsUploading()) { - if (account.httpUploadAvailable() || message.fixCounterpart()) { + if (account.httpUploadAvailable(FileBackend.getFile(message,false).getSize()) + || message.fixCounterpart()) { this.sendFileMessage(message, delay); } else { break; @@ -902,9 +903,10 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa } break; case Message.ENCRYPTION_AXOLOTL: - message.setAxolotlFingerprint(account.getAxolotlService().getOwnFingerprint()); + message.setFingerprint(account.getAxolotlService().getOwnFingerprint()); if (message.needsUploading()) { - if (account.httpUploadAvailable() || message.fixCounterpart()) { + if (account.httpUploadAvailable(FileBackend.getFile(message,false).getSize()) + || message.fixCounterpart()) { this.sendFileMessage(message, delay); } else { break; @@ -948,7 +950,7 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa } break; case Message.ENCRYPTION_AXOLOTL: - message.setAxolotlFingerprint(account.getAxolotlService().getOwnFingerprint()); + message.setFingerprint(account.getAxolotlService().getOwnFingerprint()); break; } } @@ -2564,9 +2566,9 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa if (unreadCount != count) { Logging.d(Config.LOGTAG, "update unread count to " + count); if (count > 0) { - ShortcutBadger.with(getApplicationContext()).count(count); + ShortcutBadger.applyCount(getApplicationContext(), count); } else { - ShortcutBadger.with(getApplicationContext()).remove(); + ShortcutBadger.removeCount(getApplicationContext()); } unreadCount = count; } |