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?

有帮助吗?

解决方案

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;       
    }
  }
}
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top