1

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?

Monish Koyott
  • 374
  • 1
  • 4
  • 20
K T
  • 11
  • 3
  • If they are _Jabbar users_ then its obvious that the JID was already created. What code have you tried already? – Sunil Dec 18 '17 at 03:12
  • i have tried code for chating and it was success with two jabber ID. but that jabber ID has created by jabber.at web site. but, i want to create jabber account with my c# app. – K T Dec 20 '17 at 10:28

1 Answers1

1

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
}
Sunil
  • 3,404
  • 10
  • 23
  • 31