Closed GoogleCodeExporter closed 9 years ago
Do the vCard request as usual:
private void jabberClient1_OnAuthenticate(object sender)
{
VCardIQ iq = new VCardIQ(jabberClient1.Document);
iq.To = "hildjj@gmail.com";
iq.Type = IQType.get;
jabberClient1.Tracker.BeginIQ(iq, GotVcard, null);
}
if you're on HEAD of subversion, do:
private void GotVcard(object sender, IQ iq, object state)
{
if ((iq == null) || (iq.Type != IQType.result))
return;
VCard card = iq.Query as VCard;
if (card == null)
return;
VCard.VPhoto photo = card.Photo;
pictureBox1.Image = photo.Image;
}
Otherwise, if you're on the 2.1 release version or earlier, do something like
this:
private void GotVcard(object sender, IQ iq, object state)
{
if ((iq == null) || (iq.Type != IQType.result))
return;
VCard card = iq.Query as VCard;
if (card == null)
return;
// TODO: null checks
VCard.VPhoto photo = card.Photo;
byte[] bin = Convert.FromBase64String(photo["BINVAL"].InnerText);
System.IO.MemoryStream ms = new System.IO.MemoryStream(bin);
pictureBox1.Image = System.Drawing.Image.FromStream(ms);
}
Original comment by hil...@gmail.com
on 5 Aug 2008 at 10:25
Thanks you, it helps me ;)
Original comment by labecot....@gmail.com
on 4 Nov 2009 at 1:03
Original issue reported on code.google.com by
premchan...@gmail.com
on 31 Jul 2008 at 6:14