use display name to generate own avatar

This commit is contained in:
Christian Schneppe 2018-11-23 14:13:03 +01:00
parent 0b48b57994
commit 8b3ba7fa91
2 changed files with 4 additions and 1 deletions

View file

@ -12,6 +12,7 @@ import android.graphics.RectF;
import android.graphics.Typeface;
import android.net.Uri;
import android.support.annotation.Nullable;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.util.Log;
import android.util.LruCache;
@ -406,7 +407,8 @@ public class AvatarService implements OnAdvancedStreamFeaturesLoaded {
}
avatar = mXmppConnectionService.getFileBackend().getAvatar(account.getAvatar(), size);
if (avatar == null) {
avatar = get(account.getJid().asBareJid().toString(), null, size, false);
final String jid = account.getJid().asBareJid().toEscapedString();
avatar = get(jid, null, size, false);
}
mXmppConnectionService.getBitmapCache().put(KEY, avatar);
return avatar;

View file

@ -4224,6 +4224,7 @@ public class XmppConnectionService extends Service {
} else {
request = mIqGenerator.publishNick(displayName);
}
mAvatarService.clear(account);
sendIqPacket(account, request, (account1, packet) -> {
if (packet.getType() == IqPacket.TYPE.ERROR) {
Log.d(Config.LOGTAG, account1.getJid().asBareJid() + ": unable to modify nick name " + packet.toString());