About vCard PREFIX node

Hello!

I am using OpenFire Server 3.9 with smack library v 4.1.1 on Android.

Server sends XMPP data such this:

"

Lina

Информация о пользователе

Lina

Ms

image/jpeg

/9j/4AAQSkZJR … 0bX3H/9k=

  • *

"

On the client (Android with Smack v 4.1.1) I can not read “Ms” value. There is no such value in the object Stanza. All values are present except “PREFIX”.

I began investigation and have found that “Stanzas” objects are returned after they were processed by “VCardProvider” class . In “VCardProvider” for parsing nodes with name “N” used method “parseName” that ignores child nodes with name “PREFIX”.

What is the best solution for get value from “PREFIX” node in XMPP Vcard ?

Thanks for reporting: SMACK-673.

What is the best solution for get value from “PREFIX” node in XMPP Vcard ?
Until SMACK-673 is fixed, you could replace the provider and subclass vcard.

May be exist a way that I can receive in my code unprocessed stanza using XMPPTCPConnection or any other?

If it is possible I could parse stanza as I want, and get needed “PREFIX” value.

That is what Smack’s provider do.

Thank you very much. Please answer a couple of questions more How I can do this without modifying existing compiled (jar) Smack library? May be exist a way how I can do this without modifying existing smack library source code?

As I said before, by replacing the existing vCard provider and subclassing the vcard class.

I’ve uploaded Smack 4.1.2-SNAPSHOT with support for vCard Prefix and Suffix. Could you test and report back if it fixes the issue for you?

Thanks for efficiency. I already tested. Now I can receive PREFIX node from stanza. It works fine.

But I could not write PREFIX node to Stanza. When I am sending new VCard object with “prefix” property, there is no PREFIX node in XML output.

Fixed and uploaded a new snapshot. Please test and report back.

Reporting.

I use “org.igniterealtime.smack:smack-android-extensions:4.1.2-SNAPSHOT” in my gradle settings to take Smack library.

It seems that it is not fixed, because there is no “PREFIX” node in XML output.

Additionally I have found that node “FN” absent in XML output too.

Are you sure that the Snapshot dependcy was refreshed? What does SmackConfiguration.getVersion() return?

It returns “4.1.2-SNAPSHOT (4.1.1-8-gbb ac50 2015-06-03)”.

For setting node “FN” I use ‘card.setField(“FN”, “test FN”)’.

For setting node “PREFIX” ‘card.setPrefix(“test PREFIX”)’

For saving VCard object on the server “mVCardManager.saveVCard(card)”.

All needed fields sends correctly except this two ones.

4.1.1-8-gbbac50

that’s the old git revision, it should read g6f090c. Please refresh the snapshot dependency.

For setting node “FN” I use ‘card.setField(“FN”, “test FN”)’.

Do not use setField for ‘FN’, as it’s computed automatically.

Hello!

Now version shows “4.1.2-SNAPSHOT (4.1.1-8-g6f090cf 2015-06-03)”, but “PREFIX” node still absent in XML output.

Alright, next try, there was a funny guard I missed. This time, it should be gc1192f1

Hello,

Thank you! It seems that it is works fine. Next I will be waiting for relise of 4.1.2 version