aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2016-06-04 09:57:04 +0200
committerChristian Schneppe <christian@pix-art.de>2016-06-04 09:57:04 +0200
commitc54d30ac003fec40b5263cf9948c20d3163eda7b (patch)
tree7d4cfbf918bd4812782c2851d6c838a153ab5f5f /src/main/java/eu/siacs
parent398eacc0f022aec869cac003e61ced7215c178fa (diff)
parent6639d0f23bb983cae7234d6b15f9875464c67093 (diff)
Merge remote-tracking branch 'refs/remotes/siacs/master'
Diffstat (limited to 'src/main/java/eu/siacs')
-rw-r--r--src/main/java/eu/siacs/conversations/entities/Bookmark.java5
-rw-r--r--src/main/java/eu/siacs/conversations/entities/Conversation.java6
-rw-r--r--src/main/java/eu/siacs/conversations/entities/MucOptions.java4
-rw-r--r--src/main/java/eu/siacs/conversations/http/HttpDownloadConnection.java12
-rw-r--r--src/main/java/eu/siacs/conversations/services/XmppConnectionService.java7
5 files changed, 20 insertions, 14 deletions
diff --git a/src/main/java/eu/siacs/conversations/entities/Bookmark.java b/src/main/java/eu/siacs/conversations/entities/Bookmark.java
index 7c2f73b36..3f3707d01 100644
--- a/src/main/java/eu/siacs/conversations/entities/Bookmark.java
+++ b/src/main/java/eu/siacs/conversations/entities/Bookmark.java
@@ -51,8 +51,9 @@ public class Bookmark extends Element implements ListItem {
public String getDisplayName() {
if (this.mJoinedConversation != null) {
return this.mJoinedConversation.getName();
- } else if (getBookmarkName() != null) {
- return getBookmarkName();
+ } else if (getBookmarkName() != null
+ && !getBookmarkName().trim().isEmpty()) {
+ return getBookmarkName().trim();
} else {
return this.getJid().getLocalpart();
}
diff --git a/src/main/java/eu/siacs/conversations/entities/Conversation.java b/src/main/java/eu/siacs/conversations/entities/Conversation.java
index c194ad7d2..f10cd6780 100644
--- a/src/main/java/eu/siacs/conversations/entities/Conversation.java
+++ b/src/main/java/eu/siacs/conversations/entities/Conversation.java
@@ -433,8 +433,10 @@ public class Conversation extends AbstractEntity implements Blockable {
if (getMode() == MODE_MULTI) {
if (getMucOptions().getSubject() != null) {
return getMucOptions().getSubject();
- } else if (bookmark != null && bookmark.getBookmarkName() != null) {
- return bookmark.getBookmarkName();
+ } else if (bookmark != null
+ && bookmark.getBookmarkName() != null
+ && !bookmark.getBookmarkName().trim().isEmpty()) {
+ return bookmark.getBookmarkName().trim();
} else {
String generatedName = getMucOptions().createNameFromParticipants();
if (generatedName != null) {
diff --git a/src/main/java/eu/siacs/conversations/entities/MucOptions.java b/src/main/java/eu/siacs/conversations/entities/MucOptions.java
index 043bc03d0..159dced15 100644
--- a/src/main/java/eu/siacs/conversations/entities/MucOptions.java
+++ b/src/main/java/eu/siacs/conversations/entities/MucOptions.java
@@ -503,8 +503,8 @@ public class MucOptions {
public String getProposedNick() {
if (conversation.getBookmark() != null
&& conversation.getBookmark().getNick() != null
- && !conversation.getBookmark().getNick().isEmpty()) {
- return conversation.getBookmark().getNick();
+ && !conversation.getBookmark().getNick().trim().isEmpty()) {
+ return conversation.getBookmark().getNick().trim();
} else if (!conversation.getJid().isBareJid()) {
return conversation.getJid().getResourcepart();
} else {
diff --git a/src/main/java/eu/siacs/conversations/http/HttpDownloadConnection.java b/src/main/java/eu/siacs/conversations/http/HttpDownloadConnection.java
index a3bcbb386..01a9002e7 100644
--- a/src/main/java/eu/siacs/conversations/http/HttpDownloadConnection.java
+++ b/src/main/java/eu/siacs/conversations/http/HttpDownloadConnection.java
@@ -313,16 +313,14 @@ public class HttpDownloadConnection implements Transferable {
throw new CancellationException();
}
}
+ try {
+ os.flush();
+ } catch (IOException e) {
+ throw new WriteException();
+ }
} catch (CancellationException | IOException e) {
throw e;
} finally {
- if (os != null) {
- try {
- os.flush();
- } catch (final IOException ignored) {
-
- }
- }
FileBackend.close(os);
FileBackend.close(is);
wakeLock.release();
diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
index 0cbf88caa..11f87a1d6 100644
--- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
+++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
@@ -1557,7 +1557,12 @@ public class XmppConnectionService extends Service {
}
}
if (account.getXmppConnection() != null) {
- this.disconnect(account, true);
+ new Thread(new Runnable() {
+ @Override
+ public void run() {
+ disconnect(account, true);
+ }
+ });
}
Runnable runnable = new Runnable() {
@Override