Question

I want to get my Vcard from server. I send my Vcard to server by this code:

VcardIq viq = new VcardIq(IqType.set, new Jid(XmppCon.Server));
viq.Vcard.Nickname = "Alex";
XmppCon.Send(viq); 

And I know from this,that how to get other user's Vcard.But this method don't work for my registered Id. Can anyone help me to get my Vcard from server in agsXMPP?

Était-ce utile?

La solution

Here is a sample code

public void GetMyVcard()
{
  VcardIq viq = new VcardIq(IqType.get);  
  xmppCon.IqGrabber.SendIq(viq, new IqCB(VcardResult), null);
}

private void VcardResult(object sender, IQ iq, object data)
{
  if (iq.Type == IqType.result)
  {
    Vcard vcard = iq.Vcard;
    if (vcard != null)
    {
      string fullname = vcard.Fullname;
      string nickname = vcard.Nickname;
      string description = vcard.Description;
      Photo photo = vcard.Photo;       
    }
  }
}
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top