如何在 c# .net 中使用 agsXMPP 库创建 Jabber 帐户?
我曾尝试在两个 Jabber 用户之间聊天,但对于他们两个,JID 已经在 Jabber 网站注册时创建。
但是,我想在 C# 应用程序中使用 agsXMPP 库创建 JID 注册。
这可能吗?
在连接之前,您必须将RegisterAccount属性设置为 true。图书馆尝试注册新帐户并在成功后使用此帐户登录(如果成功)。
成功创建帐户时引发OnRegistered事件。
OnRegisterError事件在错误时被调用。
XmppClientConnection xmpp = new XmppClientConnection();
// other code
xmpp.Username = "userName";
xmpp.Password = "secretPassword";
xmpp.RegisterAccount = true;
xmpp.OnRegisterError += xmpp_OnRegisterError;
xmpp.OnRegistered += xmpp_OnRegistered;
xmpp.Open();
void xmpp_OnRegistered(object sender)
{
//handle accordingly
}
void xmpp_OnRegisterError(object sender, agsXMPP.Xml.Dom.Element e)
{
//handle accordingly
}