3

Please help, I am stuck with this issue.

Basically I am getting a AVATAR BASED VCARD i can see that in debug mode, but ASMACK is not parsing image properly. Its just dropping the tag which contains the image value.

Logcat shows the XML being received:

DEBUG/SMACK(1336): <NICKNAME>TC</NICKNAME>
DEBUG/SMACK(1336): <PHOTO><TYPE>im
DEBUG/SMACK(1336): age/jpeg</TYPE><BINVAL>iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAACHklEQVR42u2Zv64BQRSH9xmUCrUHEAUShUqlshWJxhOIECJ0oqIQL6BTK
DEBUG/SMACK(1336): 1AKrcYDkEgkKq3/9ya/5DQnTmaxbnb2zkm+Yu1a51szs2dmrJ8vxf1+BzxutxtwK6x/LyAlSvF4PACP6/UKjMBfNR2VqBF4N6QmQgnzxN0WMQIqkXevMwLvdlqe4G63A
DEBUG/SMACK(1336): 5fLBXiuE2svoGoalmWB0WgEtOvE2ghIxVoymQSFQgEUi0VgBF4VOB6PYDqdgslkAmazGaDPicViAYLBIKBotVognU6DT5us/wToBHU2Oq7X68C2bdDtdkGn03lKu90GJ
DEBUG/SMACK(1336): Mjv3+/3QTweB+fzGagGBd5E9RfgiUpfqNVqYLVaAacTlNPpBKQYDocgHA4D/gBVL1D9BaQTXKharYL5fA5IjP+ldKyaMvJye7PZgEAgAKR8uJj+AqpijIKa0HK5BE6HO
DEBUG/SMACK(1336): UmQx3g8BpFIBPDrxFJFewFVUUY3ajQagDoxF3e6TMK/V6lUQCwWA7zslvLxj4DTKV65XAaJRAJQcZbL5UA+nwd0nM1mwWAwADwhuq5UKgFJkI6lpqe/wKsLVNvtFhwOB
DEBUG/SMACK(1336): 7Df759CL7BQKAQoMpkMaDabgIT4g5R+n1/nXwG3IhqNglQqBXq9HvD8/oB2AryT0XBIk/r1eg08u6yirYCqFPnWgpYRkMpd1YvRs5t82grwxKmo+/bGhhF4VcyzGxy+E
DEBUG/SMACK(1336): aDhUhpWnU5djYBbGxtuD5e+FfgFV75bC/jUS/sAAAAASUVORK5CYII=</BINVAL></PHOTO>
DEBUG/SMACK(1336): <EMAIL><HOME/><INTERNET/><PREF/><USERID>test@test.com</
DEBUG/SMACK(1336): USERID>

Here, outputting the packet in my message listener, you can see that the photo tag is dropped. I don't know why asmack doesn't show this.

class MyPacketListener implements PacketListener{
    public void processPacket(Packet packet){
        System.out.println("IQ Received XML : " + packet);  
        Log.i("Packet IQ", packet.toString());              
    }          
}

Here is the logcat output:

INFO/System.out(1336): <NICKNAME>TC</NICKNAME>
INFO/System.out(1336): <TITLE></TITLE>
INFO/System.out(1336): <EMAIL><HOME/><INTERNET/><PREF/><USERID>test@test.com</USERID>
Christopher Orr
  • 110,418
  • 27
  • 198
  • 193
Programmer
  • 5,360
  • 10
  • 37
  • 61

1 Answers1

1

In org/jivesoftware/smackx/provider/VCardProvider.java, circa line 117, there is this line:

vCard.setEncodedImage(getTagContents("BINVAL"));

which is incorrect. BINVAL is a child of PHOTO, not of vCard. Therefore, the image is getting set to NULL.

Joe Hildebrand
  • 10,354
  • 2
  • 38
  • 48
  • Joe..but i m using a compliled libray jar file, called from beem project..is there any alternative way. plz guide.. – Programmer Sep 27 '11 at 05:24
  • I have also tried sending IQ Pakcets and the same thing is happening there as well, i have posted a question on that. Basically I am sending IQ packets and getting vcard with image in debug mode, but somehow the IQ Pakcet listner is dropping to Avatar when i write packet.toXML() or packet.toString, Is it that one cant print the binary value on console or log. Plz help me in that... – Programmer Sep 27 '11 at 05:32
  • It'is a bug in the library. It needs to be fixed. You can either compile the code yourself, use a different library, or write one from scratch yourself, which I do not recommend. – Joe Hildebrand Sep 27 '11 at 16:44
  • ASmack seems to be about the only choice for Android at the moment. File a bug. Maybe they will fix it for you. – Joe Hildebrand Sep 28 '11 at 16:55
  • VDroid: See [this question](http://stackoverflow.com/q/4769020/194894) for XMPP Android library solutions. – Flow Oct 05 '11 at 16:23
  • Joe Hildebrand: Did you already open an bug for this on [upstream smack by posting to the jive forums](http://community.igniterealtime.org/community/developers/smack)? Also would do you think about making the "asmack" and "smack" tag synonyms? I think it makes sense because everything that is related to smack is interesting for asmack users and asmack itself consists only of a few patches for smack. – Flow Oct 05 '11 at 16:24
  • A) I don't care if the bug gets fixed, I was just trying to help the OP, who needs to be the one to file the bug. B) Seems reasonable. Please vote here: http://stackoverflow.com/tags/smack/synonyms – Joe Hildebrand Oct 06 '11 at 20:02