aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/eu/siacs/conversations/entities/MucOptions.java2
-rw-r--r--src/main/java/eu/siacs/conversations/parser/PresenceParser.java10
-rw-r--r--src/main/java/eu/siacs/conversations/services/XmppConnectionService.java19
-rw-r--r--src/main/java/eu/siacs/conversations/ui/ConversationFragment.java3
4 files changed, 23 insertions, 11 deletions
diff --git a/src/main/java/eu/siacs/conversations/entities/MucOptions.java b/src/main/java/eu/siacs/conversations/entities/MucOptions.java
index 097f4e30..9d54a86d 100644
--- a/src/main/java/eu/siacs/conversations/entities/MucOptions.java
+++ b/src/main/java/eu/siacs/conversations/entities/MucOptions.java
@@ -116,7 +116,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/eu/siacs/conversations/parser/PresenceParser.java b/src/main/java/eu/siacs/conversations/parser/PresenceParser.java
index d812b85d..46ce61b7 100644
--- a/src/main/java/eu/siacs/conversations/parser/PresenceParser.java
+++ b/src/main/java/eu/siacs/conversations/parser/PresenceParser.java
@@ -184,10 +184,16 @@ 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()) {
+ if (avatar != null && (!contact.isSelf() || account.getAvatar() == null)) {
avatar.owner = from.toBareJid();
if (mXmppConnectionService.getFileBackend().isAvatarCached(avatar)) {
- if (contact.setAvatar(avatar)) {
+ 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();
diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
index 2fb33bb6..4374b3f6 100644
--- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
+++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
@@ -2036,7 +2036,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);
@@ -2739,12 +2739,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/eu/siacs/conversations/ui/ConversationFragment.java b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java
index 5fd654fa..edee551b 100644
--- a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java
+++ b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java
@@ -43,7 +43,6 @@ import java.util.UUID;
import eu.siacs.conversations.Config;
import eu.siacs.conversations.R;
-import eu.siacs.conversations.crypto.axolotl.AxolotlService;
import eu.siacs.conversations.entities.Account;
import eu.siacs.conversations.entities.Contact;
import eu.siacs.conversations.entities.Conversation;
@@ -865,7 +864,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: