powered by Jive Software

Get photo url from EXTVAL tag within vCard

I am fetching user info like nickname and their photo. Below is the result I can see from smack logs:

<iq xml:lang='en-GB' to='user1@test.io/11219255418750518867' from='user2@test.io' type='result' id='DBN36-28'>
      <vCard xmlns='vcard-temp'>
        <NICKNAME>
          Cooler
        </NICKNAME>
        <PHOTO>
          <EXTVAL>
            https://dummyurl.com/test/97001600429297769.jpeg
          </EXTVAL>
        </PHOTO>
      </vCard>
    </iq>

When I am trying to get above response using below code:

connection!!.addAsyncStanzaListener(this, IQTypeFilter.RESULT)

override fun processStanza(packet: Stanza?) {
        Log.e("XMPP","processStanza: "+packet?.toXML())
    }

I am getting below result in procesStanza:

<iq xml:lang='en-GB' to='user1@test.io/11219255418750518867' from='user2@test.io' type='result' id='DBN36-28'>
      <vCard xmlns='vcard-temp'>
        <NICKNAME>
          Cooler
        </NICKNAME>
      </vCard>
    </iq>

I am not getting a photo tag within it.

I am using smack 4.4.0-beta1 version.

Reading the source code I’d say that Smack is lacking support for EXTVAL children of the PHOTO field.

Yeah right. So, Is there any workaround for getting EXTVAL value?

Note that this is SMACK-684.

There are multiple ways to work around that. For example, you could register your onw provider for vcards, which is able to parse EXTVAL and replace Smack’s whole vcard code.