Subject: Unable to login or register user
Below is my code please help me on this,
- using agsXMPP;
- using agsXMPP.protocol.client;
- using System.Diagnostics;
- using agsXMPP.protocol.iq.roster;
- using agsXMPP.Xml.Dom;
- using agsXMPP.sasl;
- public async Task<bool> XMPPValidateUser(string jabberId, string jabberPassword)
- {
- string userId = jabberId.Split("@")[0];
- string server = jabberId.Split("@")[1];
- try
- {
- xmpp.AutoResolveConnectServer = true;
- xmpp.Port = 5222;
- xmpp.UseSSL = false;
- xmpp.Server = server;
- xmpp.Username = userId;
- xmpp.Password = jabberPassword;
- xmpp.RegisterAccount = false;
- xmpp.Open();
- return xmpp.Authenticated;
- }
- catch (Exception ex)
- {
- return false;
- }
- }
- public async Task<bool> XMPPCreateUser(string jabberId, string jabberPassword)
- {
- string userId = jabberId.Split("@")[0];
- string server = jabberId.Split("@")[1];
- try
- {
- xmpp.AutoResolveConnectServer = true;
- xmpp.Port = 5222;
- xmpp.UseSSL = false;
- xmpp.Server = server;
- xmpp.Username = userId;
- xmpp.Password = jabberPassword;
- xmpp.RegisterAccount = true;
- xmpp.Open();
- //xmpp.OnError += new ErrorHandler(xmpp_OnError);
- }
- catch (Exception ex)
- {
- return false;
- }
- return true;
- }
- public async void xmpp_OnLogin(object sender)
- {
- try
- {
- xmpp.Close();
- }
- catch (Exception ex)
- {
- }
- }