aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian S <christian@pix-art.de>2016-05-06 11:58:19 +0200
committerChristian S <christian@pix-art.de>2016-05-06 11:58:19 +0200
commita1e951efe2e24137164d7857270a982a4ee0ae45 (patch)
tree986a2d963876033f14d8e9ed4abf01fe82a2414c
parent8f0f7e94a9626ef51f149f83f04dcb030f1b3234 (diff)
parente2d3bef7397984b1b717ec4a5bf60f572da73779 (diff)
Merge remote-tracking branch 'refs/remotes/siacs/master' into development
-rw-r--r--src/main/java/eu/siacs/conversations/crypto/axolotl/XmppAxolotlMessage.java1
-rw-r--r--src/main/java/eu/siacs/conversations/entities/Account.java5
-rw-r--r--src/main/java/eu/siacs/conversations/persistance/FileBackend.java2
-rw-r--r--src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java24
-rw-r--r--src/main/res/values/strings.xml1
5 files changed, 22 insertions, 11 deletions
diff --git a/src/main/java/eu/siacs/conversations/crypto/axolotl/XmppAxolotlMessage.java b/src/main/java/eu/siacs/conversations/crypto/axolotl/XmppAxolotlMessage.java
index cf950d6da..93a736778 100644
--- a/src/main/java/eu/siacs/conversations/crypto/axolotl/XmppAxolotlMessage.java
+++ b/src/main/java/eu/siacs/conversations/crypto/axolotl/XmppAxolotlMessage.java
@@ -158,7 +158,6 @@ public class XmppAxolotlMessage {
IvParameterSpec ivSpec = new IvParameterSpec(iv);
Cipher cipher = Cipher.getInstance(CIPHERMODE, PROVIDER);
cipher.init(Cipher.ENCRYPT_MODE, secretKey, ivSpec);
- this.innerKey = secretKey.getEncoded();
this.ciphertext = cipher.doFinal(plaintext.getBytes());
} catch (NoSuchAlgorithmException | NoSuchPaddingException | InvalidKeyException
| IllegalBlockSizeException | BadPaddingException | NoSuchProviderException
diff --git a/src/main/java/eu/siacs/conversations/entities/Account.java b/src/main/java/eu/siacs/conversations/entities/Account.java
index 1bcb15c07..1a7798b2d 100644
--- a/src/main/java/eu/siacs/conversations/entities/Account.java
+++ b/src/main/java/eu/siacs/conversations/entities/Account.java
@@ -93,7 +93,8 @@ public class Account extends AbstractEntity {
REGISTRATION_NOT_SUPPORTED(true),
SECURITY_ERROR(true),
INCOMPATIBLE_SERVER(true),
- TOR_NOT_AVAILABLE(true);
+ TOR_NOT_AVAILABLE(true),
+ BIND_FAILURE(true);
private final boolean isError;
@@ -139,6 +140,8 @@ public class Account extends AbstractEntity {
return R.string.account_status_incompatible_server;
case TOR_NOT_AVAILABLE:
return R.string.account_status_tor_unavailable;
+ case BIND_FAILURE:
+ return R.string.account_status_bind_failure;
default:
return R.string.account_status_unknown;
}
diff --git a/src/main/java/eu/siacs/conversations/persistance/FileBackend.java b/src/main/java/eu/siacs/conversations/persistance/FileBackend.java
index 192313da4..fe27cda5f 100644
--- a/src/main/java/eu/siacs/conversations/persistance/FileBackend.java
+++ b/src/main/java/eu/siacs/conversations/persistance/FileBackend.java
@@ -134,10 +134,12 @@ public class FileBackend {
public static boolean allFilesUnderSize(Context context, List<Uri> uris, long max) {
if (max <= 0) {
+ Log.d(Config.LOGTAG,"server did not report max file size for http upload");
return true; //exception to be compatible with HTTP Upload < v0.2
}
for(Uri uri : uris) {
if (FileBackend.getFileSize(context, uri) > max) {
+ Log.d(Config.LOGTAG,"not all files are under "+max+" bytes. suggesting falling back to jingle");
return false;
}
}
diff --git a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java
index 97f204d12..687b51d81 100644
--- a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java
+++ b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java
@@ -919,22 +919,23 @@ public class XmppConnection implements Runnable {
if (jid != null && jid.getContent() != null) {
try {
account.setResource(Jid.fromString(jid.getContent()).getResourcepart());
+ if (streamFeatures.hasChild("session")) {
+ sendStartSession();
+ } else {
+ sendPostBindInitialization();
+ }
+ return;
} catch (final InvalidJidException e) {
- // TODO: Handle the case where an external JID is technically invalid?
- }
- if (streamFeatures.hasChild("session")) {
- sendStartSession();
- } else {
- sendPostBindInitialization();
+ Log.d(Config.LOGTAG,account.getJid().toBareJid()+": server reported invalid jid ("+jid.getContent()+") on bind");
}
} else {
Log.d(Config.LOGTAG, account.getJid() + ": disconnecting because of bind failure. (no jid)");
- disconnect(true);
}
} else {
Log.d(Config.LOGTAG, account.getJid() + ": disconnecting because of bind failure (" + packet.toString());
- disconnect(true);
}
+ forceCloseSocket();
+ changeStatus(Account.State.BIND_FAILURE);
}
});
}
@@ -1568,7 +1569,12 @@ public class XmppConnection implements Runnable {
if (items.size() > 0) {
try {
long maxsize = Long.parseLong(items.get(0).getValue().getExtendedDiscoInformation(Xmlns.HTTP_UPLOAD, "max-file-size"));
- return filesize <= maxsize;
+ if(filesize <= maxsize) {
+ return true;
+ } else {
+ Log.d(Config.LOGTAG,account.getJid().toBareJid()+": http upload is not available for files with size "+filesize+" (max is "+maxsize+")");
+ return false;
+ }
} catch (Exception e) {
return true;
}
diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml
index ecc715de9..643a8168d 100644
--- a/src/main/res/values/strings.xml
+++ b/src/main/res/values/strings.xml
@@ -560,6 +560,7 @@
<string name="no_update_available">No update available</string>
<string name="download_started">Download started</string>
<string name="account_status_tor_unavailable">Tor network unavailable</string>
+ <string name="account_status_bind_failure">Bind failure</string>
<string name="server_info_broken">Broken</string>
<string name="pref_presence_settings">Presence</string>
<string name="pref_away_when_screen_off">Away when screen is off</string>