diff options
Diffstat (limited to 'src/main/java/de/pixart')
4 files changed, 26 insertions, 13 deletions
diff --git a/src/main/java/de/pixart/messenger/entities/MucOptions.java b/src/main/java/de/pixart/messenger/entities/MucOptions.java index d74c5549d..51e502deb 100644 --- a/src/main/java/de/pixart/messenger/entities/MucOptions.java +++ b/src/main/java/de/pixart/messenger/entities/MucOptions.java @@ -115,7 +115,7 @@ public class MucOptions { public enum Error { NO_RESPONSE, - SEVRER_NOT_FOUND, + SERVER_NOT_FOUND, NONE, NICK_IN_USE, PASSWORD_REQUIRED, diff --git a/src/main/java/de/pixart/messenger/parser/PresenceParser.java b/src/main/java/de/pixart/messenger/parser/PresenceParser.java index 31f2fdcae..477aff0ba 100644 --- a/src/main/java/de/pixart/messenger/parser/PresenceParser.java +++ b/src/main/java/de/pixart/messenger/parser/PresenceParser.java @@ -183,12 +183,18 @@ public class PresenceParser extends AbstractParser implements final String resource = from.isBareJid() ? "" : from.getResourcepart(); contact.setPresenceName(packet.findChildContent("nick", "http://jabber.org/protocol/nick")); Avatar avatar = Avatar.parsePresence(packet.findChild("x", "vcard-temp:x:update")); - if (avatar != null && !contact.isSelf()) { - avatar.owner = from.toBareJid(); + if (avatar != null && (!contact.isSelf() || account.getAvatar() == null)) { + avatar.owner = from.toBareJid(); if (mXmppConnectionService.getFileBackend().isAvatarCached(avatar)) { - if (contact.setAvatar(avatar)) { - mXmppConnectionService.getAvatarService().clear(contact); - mXmppConnectionService.updateConversationUi(); + if (avatar.owner.equals(account.getJid().toBareJid())) { + account.setAvatar(avatar.getFilename()); + mXmppConnectionService.databaseBackend.updateAccount(account); + mXmppConnectionService.getAvatarService().clear(account); + mXmppConnectionService.updateConversationUi(); + mXmppConnectionService.updateAccountUi(); + } else if (contact.setAvatar(avatar)) { + mXmppConnectionService.getAvatarService().clear(contact); + mXmppConnectionService.updateConversationUi(); mXmppConnectionService.updateRosterUi(); } } else if (mXmppConnectionService.isDataSaverDisabled()){ diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java index 38cb67b2a..6be77bf9a 100644 --- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java +++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java @@ -2117,7 +2117,7 @@ public class XmppConnectionService extends Service { @Override public void onFetchFailed(final Conversation conversation, Element error) { if (error != null && "remote-server-not-found".equals(error.getName())) { - conversation.getMucOptions().setError(MucOptions.Error.SEVRER_NOT_FOUND); + conversation.getMucOptions().setError(MucOptions.Error.SERVER_NOT_FOUND); } else { join(conversation); fetchConferenceConfiguration(conversation); @@ -2820,12 +2820,19 @@ public class XmppConnectionService extends Service { Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": successfully fetched vCard avatar for " + avatar.owner); if (avatar.owner.isBareJid()) { - Contact contact = account.getRoster() - .getContact(avatar.owner); - contact.setAvatar(avatar); - getAvatarService().clear(contact); + if (account.getJid().toBareJid().equals(avatar.owner) && account.getAvatar() == null) { + Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": had no avatar. replacing with vcard"); + account.setAvatar(avatar.getFilename()); + databaseBackend.updateAccount(account); + getAvatarService().clear(account); + updateAccountUi(); + } else { + Contact contact = account.getRoster().getContact(avatar.owner); + contact.setAvatar(avatar); + getAvatarService().clear(contact); + updateRosterUi(); + } updateConversationUi(); - updateRosterUi(); } else { Conversation conversation = find(account, avatar.owner.toBareJid()); if (conversation != null && conversation.getMode() == Conversation.MODE_MULTI) { diff --git a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java index 828e4516e..736c07aa9 100644 --- a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java +++ b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java @@ -875,7 +875,7 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa case NO_RESPONSE: showSnackbar(R.string.joining_conference, 0, null); break; - case SEVRER_NOT_FOUND: + case SERVER_NOT_FOUND: showSnackbar(R.string.remote_server_not_found,R.string.leave, leaveMuc); break; case PASSWORD_REQUIRED: |