aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/de/pixart/messenger/xmpp/XmppConnection.java')
-rw-r--r--src/main/java/de/pixart/messenger/xmpp/XmppConnection.java15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java b/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java
index 775f7b430..1ea8174fe 100644
--- a/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java
+++ b/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java
@@ -1755,6 +1755,8 @@ public class XmppConnection implements Runnable {
private boolean encryptionEnabled = false;
private boolean blockListRequested = false;
+ public String http_upload_namespace = Namespace.HTTP_UPLOAD;
+
public Features(final XmppConnection connection) {
this.connection = connection;
}
@@ -1844,10 +1846,15 @@ public class XmppConnection implements Runnable {
if (Config.DISABLE_HTTP_UPLOAD) {
return false;
} else {
- List<Entry<Jid, ServiceDiscoveryResult>> items = findDiscoItemsByFeature(Namespace.HTTP_UPLOAD);
+ List<Entry<Jid, ServiceDiscoveryResult>> items = findDiscoItemsByFeature(this.http_upload_namespace);
+ if (items.size() == 0) {
+ Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": this server does not support the latest version of XEP-0363");
+ this.http_upload_namespace = Namespace.HTTP_UPLOAD_LEGACY;
+ items = findDiscoItemsByFeature(this.http_upload_namespace);
+ }
if (items.size() > 0) {
try {
- long maxsize = Long.parseLong(items.get(0).getValue().getExtendedDiscoInformation(Namespace.HTTP_UPLOAD, "max-file-size"));
+ long maxsize = Long.parseLong(items.get(0).getValue().getExtendedDiscoInformation(this.http_upload_namespace, "max-file-size"));
if (filesize <= maxsize) {
return true;
} else {
@@ -1864,10 +1871,10 @@ public class XmppConnection implements Runnable {
}
public long getMaxHttpUploadSize() {
- List<Entry<Jid, ServiceDiscoveryResult>> items = findDiscoItemsByFeature(Namespace.HTTP_UPLOAD);
+ List<Entry<Jid, ServiceDiscoveryResult>> items = findDiscoItemsByFeature(this.http_upload_namespace);
if (items.size() > 0) {
try {
- return Long.parseLong(items.get(0).getValue().getExtendedDiscoInformation(Namespace.HTTP_UPLOAD, "max-file-size"));
+ return Long.parseLong(items.get(0).getValue().getExtendedDiscoInformation(this.http_upload_namespace, "max-file-size"));
} catch (Exception e) {
return -1;
}