How to create jabber account using agsXMPP c#?

256 views Asked by At

How to create Jabber account using agsXMPP library in c# .net.?

I have tried to chat between two Jabber users, but for both of them, the JID was already created on Jabber website registration.

But, I want to create JID registration using agsXMPP library in C# application.

Is this possible?

1

There are 1 answers

0
Sunil On

You have to set the RegisterAccount property to true before you connect. The library tries to register the new account and logs in with this account after success (if success).

OnRegistered event is raised when the account was created successful.
OnRegisterError event is called on errors.

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
}