use of org.jivesoftware.smackx.vcardtemp.packet.VCard in project Smack by igniterealtime.
the class VCardTest method testUnknownComplexTopLevelElementNotAdded.
@Test
public void testUnknownComplexTopLevelElementNotAdded() throws Throwable {
// @formatter:off
final String request = "<iq id='v1' to='user@igniterealtime.org/mobile' type='result'>" + "<vCard xmlns='vcard-temp'><UNKNOWN><FOO/></UNKNOWN></vCard>" + "</iq>";
// @formatter:on
VCard vCard = (VCard) PacketParserUtils.parseStanza(request);
assertEquals(null, vCard.getField("UNKNOWN"));
}
use of org.jivesoftware.smackx.vcardtemp.packet.VCard in project Smack by igniterealtime.
the class VCardTest method testPhoto.
@Test
public void testPhoto() throws Throwable {
// @formatter:off
final String request = "<iq id='v1' to='user@igniterealtime.org/mobile' type='result'>" + VCARD_XML + "</iq>";
// @formatter:on
VCard vCard = (VCard) PacketParserUtils.parseStanza(request);
byte[] avatar = vCard.getAvatar();
String mimeType = vCard.getAvatarMimeType();
assertEquals(mimeType, MIME_TYPE);
byte[] expectedAvatar = getAvatarBinary();
assertTrue(Arrays.equals(avatar, expectedAvatar));
}
use of org.jivesoftware.smackx.vcardtemp.packet.VCard in project Smack by igniterealtime.
the class VCardTest method testUnknownDeepElementNotAdded.
@Test
public void testUnknownDeepElementNotAdded() throws Throwable {
// @formatter:off
final String request = "<iq id='v1' to='user@igniterealtime.org/mobile' type='result'>" + "<vCard xmlns='vcard-temp'><UNKNOWN><UNKNOWN>1234</UNKNOWN></UNKNOWN></vCard>" + "</iq>";
// @formatter:on
VCard vCard = (VCard) PacketParserUtils.parseStanza(request);
assertEquals(null, vCard.getField("UNKNOWN"));
}
use of org.jivesoftware.smackx.vcardtemp.packet.VCard in project Smack by igniterealtime.
the class VCardManager method loadVCard.
/**
* Load VCard information for a given user.
*
* @throws XMPPErrorException
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
* @throws InterruptedException
*/
public VCard loadVCard(EntityBareJid bareJid) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
VCard vcardRequest = new VCard();
vcardRequest.setTo(bareJid);
VCard result = connection().createStanzaCollectorAndSend(vcardRequest).nextResultOrThrow();
return result;
}
use of org.jivesoftware.smackx.vcardtemp.packet.VCard in project xabber-android by redsolution.
the class AccountViewer method editAccountInfo.
private void editAccountInfo() {
VCard vCard = ((ContactVcardViewerFragment) getFragmentManager().findFragmentById(R.id.scrollable_container)).getvCard();
if (vCard != null) {
Intent intent = AccountInfoEditor.createIntent(this, account, vCard.getChildElementXML().toString());
startActivityForResult(intent, ACCOUNT_INFO_EDITOR_REQUEST_CODE);
}
}
Aggregations