use of com.xabber.xmpp.avatar.VCardUpdate in project xabber-android by redsolution.
the class PresenceManager method sendVCardUpdatePresence.
public void sendVCardUpdatePresence(String account, String hash) throws NetworkException {
final Presence presence = AccountManager.getInstance().getAccount(account).getPresence();
final VCardUpdate vCardUpdate = new VCardUpdate();
vCardUpdate.setPhotoHash(hash);
presence.addExtension(vCardUpdate);
ConnectionManager.getInstance().sendStanza(account, presence);
}
use of com.xabber.xmpp.avatar.VCardUpdate in project xabber-android by redsolution.
the class AvatarManager method onPacket.
@Override
public void onPacket(ConnectionItem connection, String bareAddress, Stanza packet) {
if (!(packet instanceof Presence) || bareAddress == null) {
return;
}
if (!(connection instanceof AccountItem)) {
return;
}
String account = ((AccountItem) connection).getAccount();
Presence presence = (Presence) packet;
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()) {
onPhotoReady(account, bareAddress, vCardUpdate);
}
}
}
}
Aggregations