aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu
diff options
context:
space:
mode:
authoriNPUTmice <daniel@gultsch.de>2015-01-14 22:48:14 +0100
committeriNPUTmice <daniel@gultsch.de>2015-01-14 22:48:14 +0100
commita6a9ed487786451f0eedfaa63fbbc5332d4adcf3 (patch)
tree67df3593ae6ea64f3516ed9be57b2a828d01a52d /src/main/java/eu
parentdf742ce1e12d9909a0b1777a839e012a6dcdc78b (diff)
handle muc nicks with white spaces. fixed #884
Diffstat (limited to '')
-rw-r--r--src/main/java/eu/siacs/conversations/services/AvatarService.java3
-rw-r--r--src/main/java/eu/siacs/conversations/utils/UIHelper.java4
2 files changed, 4 insertions, 3 deletions
diff --git a/src/main/java/eu/siacs/conversations/services/AvatarService.java b/src/main/java/eu/siacs/conversations/services/AvatarService.java
index 3ac4462d..f28dc24e 100644
--- a/src/main/java/eu/siacs/conversations/services/AvatarService.java
+++ b/src/main/java/eu/siacs/conversations/services/AvatarService.java
@@ -212,7 +212,8 @@ public class AvatarService {
}
bitmap = Bitmap.createBitmap(size, size, Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
- final String letter = name.isEmpty() ? "X" : name.substring(0,1);
+ final String trimmedName = name.trim();
+ final String letter = trimmedName.isEmpty() ? "X" : trimmedName.substring(0,1);
final int color = UIHelper.getColorForName(name);
drawTile(canvas, letter, color, 0, 0, size, size);
mXmppConnectionService.getBitmapCache().put(KEY, bitmap);
diff --git a/src/main/java/eu/siacs/conversations/utils/UIHelper.java b/src/main/java/eu/siacs/conversations/utils/UIHelper.java
index ed1db287..b00447a4 100644
--- a/src/main/java/eu/siacs/conversations/utils/UIHelper.java
+++ b/src/main/java/eu/siacs/conversations/utils/UIHelper.java
@@ -212,9 +212,9 @@ public class UIHelper {
if (counterpart==null) {
return "";
} else if (!counterpart.isBareJid()) {
- return counterpart.getResourcepart();
+ return counterpart.getResourcepart().trim();
} else {
- return counterpart.toString();
+ return counterpart.toString().trim();
}
}
}