use of com.xabber.xmpp.vcardupdate.VCardUpdate in project xabber-android by redsolution.
the class AvatarManager method onStanza.
@Override
public void onStanza(ConnectionItem connection, Stanza stanza) {
if (!(stanza instanceof Presence)) {
return;
}
AccountJid account = ((AccountItem) connection).getAccount();
Presence presence = (Presence) stanza;
if (presence.getType() == Presence.Type.error) {
return;
}
for (ExtensionElement packetExtension : presence.getExtensions()) {
if (packetExtension instanceof VCardUpdate) {
VCardUpdate vCardUpdate = (VCardUpdate) packetExtension;
if (vCardUpdate.isValid() && vCardUpdate.isPhotoReady()) {
try {
onPhotoReady(account, UserJid.from(stanza.getFrom()), vCardUpdate);
} catch (UserJid.UserJidCreateException e) {
LogManager.exception(this, e);
}
}
}
}
}
use of com.xabber.xmpp.vcardupdate.VCardUpdate in project xabber-android by redsolution.
the class PresenceManager method sendVCardUpdatePresence.
public void sendVCardUpdatePresence(AccountJid account, String hash) throws NetworkException {
LogManager.i(this, "sendVCardUpdatePresence: " + account);
AccountItem accountItem = AccountManager.getInstance().getAccount(account);
if (accountItem == null) {
return;
}
final Presence presence = accountItem.getPresence();
final VCardUpdate vCardUpdate = new VCardUpdate();
vCardUpdate.setPhotoHash(hash);
presence.addExtension(vCardUpdate);
StanzaSender.sendStanza(account, presence);
}
Aggregations