0

I am trying to register an account on my eJabberd server using the agsXMPP library. This is my code which is pretty much the same like here:

http://www.codeproject.com/Articles/21267/Creating-a-Jabber-Client-using-the-agsXMPP-Library

static void Main(string[] args)
{
    string JID_Sender = "newaccount@pc-michi";
    string Password = "123";

    Jid jidSender = new Jid(JID_Sender);
    XmppClientConnection xmpp = new XmppClientConnection(jidSender.Server);

    xmpp.RegisterAccount = true;

    try
    {
        xmpp.Open(jidSender.User, Password);
        xmpp.OnLogin += new ObjectHandler(xmpp_OnLogin);
    }
    catch (Exception e)
    {
        Console.WriteLine(e.Message);
    }


    Console.Write("Wait for Login ");
    int i = 0;
    _wait = true;
    do
    {
        Console.Write(".");
        i++;
        if (i == 10) _wait = false;
        Thread.Sleep(500);
    } while (_wait);
    Console.WriteLine();
}

static void xmpp_OnLogin(object sender)
{
       _wait = false;
       Console.WriteLine("Logged In");
}

So, this should work fine, which it does sometimes at least. There lies the problem. The account is only created when I restart the server. Why is that possible? I have not changed anything regarding settings on the server, it is freshly installed. I have also already tried to reinstall eJabberd. Still the same result though. Do you know any solutions to this problem? Or is it just something I am missing in the code?

Here you can find my config file: http://textuploader.com/5yu90

1 Answers1

0

you are missing configration in ejabberd.yml

replace access_from: deny to access_from: allow

## Local c2s or remote s2s users cannot register accounts
##
access_from: allow

and comment this line

ip_access: trusted_network

do not forget to restart server or reload configuration file.

Sunil Singh
  • 538
  • 3
  • 12
  • Hi, sorry i could not respond faster. Unfortunately, this didn't solve my problem, still all the same. I have treid to find out where in the code the error appears and it seems as if the xmpp_OnLogin does not get called. At least I get no output "Logged In". I only get this when the process worked out – Michael Heribert Apr 24 '16 at 09:52