我想从服务器获取我的 Vcard。我通过以下代码将我的 Vcard 发送到服务器:
VcardIq viq = new VcardIq(IqType.set, new Jid(XmppCon.Server));
viq.Vcard.Nickname = "Alex";
XmppCon.Send(viq);
我从中知道如何获取其他用户的 Vcard。但是这种方法不适用于我的注册 ID。谁能帮我从 agsXMPP 的服务器上获取我的 Vcard?
这是一个示例代码
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;
}
}
}