persist muc avatar and show in bookmarks
This commit is contained in:
parent
9408dd597a
commit
dfb95f0a84
|
@ -183,10 +183,12 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece
|
||||||
mXmppConnectionService.updateAccountUi();
|
mXmppConnectionService.updateAccountUi();
|
||||||
} else {
|
} else {
|
||||||
Contact contact = account.getRoster().getContact(from);
|
Contact contact = account.getRoster().getContact(from);
|
||||||
contact.setAvatar(avatar);
|
if (contact.setAvatar(avatar)) {
|
||||||
mXmppConnectionService.getAvatarService().clear(contact);
|
mXmppConnectionService.syncRoster(account);
|
||||||
mXmppConnectionService.updateConversationUi();
|
mXmppConnectionService.getAvatarService().clear(contact);
|
||||||
mXmppConnectionService.updateRosterUi();
|
mXmppConnectionService.updateConversationUi();
|
||||||
|
mXmppConnectionService.updateRosterUi();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (mXmppConnectionService.isDataSaverDisabled()) {
|
} else if (mXmppConnectionService.isDataSaverDisabled()) {
|
||||||
mXmppConnectionService.fetchAvatar(account, avatar);
|
mXmppConnectionService.fetchAvatar(account, avatar);
|
||||||
|
|
|
@ -233,6 +233,7 @@ public class PresenceParser extends AbstractParser implements
|
||||||
mXmppConnectionService.updateConversationUi();
|
mXmppConnectionService.updateConversationUi();
|
||||||
mXmppConnectionService.updateAccountUi();
|
mXmppConnectionService.updateAccountUi();
|
||||||
} else if (contact.setAvatar(avatar)) {
|
} else if (contact.setAvatar(avatar)) {
|
||||||
|
mXmppConnectionService.syncRoster(account);
|
||||||
mXmppConnectionService.getAvatarService().clear(contact);
|
mXmppConnectionService.getAvatarService().clear(contact);
|
||||||
mXmppConnectionService.updateConversationUi();
|
mXmppConnectionService.updateConversationUi();
|
||||||
mXmppConnectionService.updateRosterUi();
|
mXmppConnectionService.updateRosterUi();
|
||||||
|
|
|
@ -888,7 +888,7 @@ public class DatabaseBackend extends SQLiteOpenHelper {
|
||||||
final SQLiteDatabase db = this.getWritableDatabase();
|
final SQLiteDatabase db = this.getWritableDatabase();
|
||||||
db.beginTransaction();
|
db.beginTransaction();
|
||||||
for (Contact contact : roster.getContacts()) {
|
for (Contact contact : roster.getContacts()) {
|
||||||
if (contact.getOption(Contact.Options.IN_ROSTER)) {
|
if (contact.getOption(Contact.Options.IN_ROSTER) || contact.getAvatar() != null) {
|
||||||
db.insert(Contact.TABLENAME, null, contact.getContentValues());
|
db.insert(Contact.TABLENAME, null, contact.getContentValues());
|
||||||
} else {
|
} else {
|
||||||
String where = Contact.ACCOUNT + "=? AND " + Contact.JID + "=?";
|
String where = Contact.ACCOUNT + "=? AND " + Contact.JID + "=?";
|
||||||
|
|
|
@ -53,7 +53,7 @@ public class AvatarService implements OnAdvancedStreamFeaturesLoaded {
|
||||||
|
|
||||||
protected XmppConnectionService mXmppConnectionService = null;
|
protected XmppConnectionService mXmppConnectionService = null;
|
||||||
|
|
||||||
public AvatarService(XmppConnectionService service) {
|
AvatarService(XmppConnectionService service) {
|
||||||
this.mXmppConnectionService = service;
|
this.mXmppConnectionService = service;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -213,7 +213,13 @@ public class AvatarService implements OnAdvancedStreamFeaturesLoaded {
|
||||||
if (bookmark.getConversation() != null) {
|
if (bookmark.getConversation() != null) {
|
||||||
return get(bookmark.getConversation(), size, cachedOnly);
|
return get(bookmark.getConversation(), size, cachedOnly);
|
||||||
} else {
|
} else {
|
||||||
String seed = bookmark.getJid() != null ? bookmark.getJid().asBareJid().toString() : null;
|
Jid jid = bookmark.getJid();
|
||||||
|
Account account = bookmark.getAccount();
|
||||||
|
Contact contact = jid == null ? null : account.getRoster().getContact(jid);
|
||||||
|
if (contact != null && contact.getAvatar() != null) {
|
||||||
|
return get(contact, size, cachedOnly);
|
||||||
|
}
|
||||||
|
String seed = jid != null ? jid.asBareJid().toString() : null;
|
||||||
return get(bookmark.getDisplayName(), seed, size, cachedOnly);
|
return get(bookmark.getDisplayName(), seed, size, cachedOnly);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -2886,10 +2886,12 @@ public class XmppConnectionService extends Service {
|
||||||
updateAccountUi();
|
updateAccountUi();
|
||||||
} else {
|
} else {
|
||||||
Contact contact = a.getRoster().getContact(avatar.owner);
|
Contact contact = a.getRoster().getContact(avatar.owner);
|
||||||
contact.setAvatar(avatar);
|
if (contact.setAvatar(avatar)) {
|
||||||
getAvatarService().clear(contact);
|
syncRoster(account);
|
||||||
updateConversationUi();
|
getAvatarService().clear(contact);
|
||||||
updateRosterUi();
|
updateConversationUi();
|
||||||
|
updateRosterUi();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (callback != null) {
|
if (callback != null) {
|
||||||
callback.success(avatar);
|
callback.success(avatar);
|
||||||
|
@ -2943,9 +2945,11 @@ public class XmppConnectionService extends Service {
|
||||||
updateAccountUi();
|
updateAccountUi();
|
||||||
} else {
|
} else {
|
||||||
Contact contact = account.getRoster().getContact(avatar.owner);
|
Contact contact = account.getRoster().getContact(avatar.owner);
|
||||||
contact.setAvatar(avatar);
|
if (contact.setAvatar(avatar)) {
|
||||||
getAvatarService().clear(contact);
|
syncRoster(account);
|
||||||
updateRosterUi();
|
getAvatarService().clear(contact);
|
||||||
|
updateRosterUi();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
updateConversationUi();
|
updateConversationUi();
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue