Search in sources :

Example 1 with VCard

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"));
}
Also used : VCard(org.jivesoftware.smackx.vcardtemp.packet.VCard) Test(org.junit.Test)

Example 2 with VCard

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));
}
Also used : VCard(org.jivesoftware.smackx.vcardtemp.packet.VCard) Test(org.junit.Test)

Example 3 with VCard

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"));
}
Also used : VCard(org.jivesoftware.smackx.vcardtemp.packet.VCard) Test(org.junit.Test)

Example 4 with VCard

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;
}
Also used : VCard(org.jivesoftware.smackx.vcardtemp.packet.VCard)

Example 5 with VCard

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);
    }
}
Also used : ContactVcardViewerFragment(com.xabber.android.ui.fragment.ContactVcardViewerFragment) Intent(android.content.Intent) VCard(org.jivesoftware.smackx.vcardtemp.packet.VCard)

Aggregations

VCard (org.jivesoftware.smackx.vcardtemp.packet.VCard)15 Test (org.junit.Test)10 ContactVcardViewerFragment (com.xabber.android.ui.fragment.ContactVcardViewerFragment)2 Intent (android.content.Intent)1 AccountItem (com.xabber.android.data.account.AccountItem)1 ConnectionThread (com.xabber.android.data.connection.ConnectionThread)1 IOException (java.io.IOException)1 SmackException (org.jivesoftware.smack.SmackException)1 XMPPException (org.jivesoftware.smack.XMPPException)1 XmlPullParserException (org.xmlpull.v1.XmlPullParserException)1