alexyoung / ircd.js

A Node ircd (IRC daemon)
GNU General Public License v3.0
528 stars 90 forks source link

Adding callback when the server is booted #68

Closed ChristianGaertner closed 9 years ago

ChristianGaertner commented 10 years ago

This way you can see when the server is booted.

sespindola commented 9 years ago

I'm sorry, but I don't see any benefit from wrapping the boot function in a callback, since it's supposed to run when lib/server.js is run from node directly.

I'm closing this, but feel free to resubmit if you can think of a good reason to do this.

Regards, Sebastian.

ChristianGaertner commented 9 years ago

This callback allows to start the server and pre-create channels, without users connecting:

var server = null;
irc.boot(function(err, serv) {
        server = serv;
});

someStuff(function() {
    if (server != null) {
        var keys = Object.keys(server.channels.registered);
        var channel = server.channels.registered[keys[0]]

        if (channel !== null) {
            channel.send(':' + username + '!~' + username + '@host PRIVMSG #channel :' + message);  
        }
    }
}

This allows to create bridges between non-irc chats to irc very easy, without this proposed callback there is no easy way to do this. atm.

But if you think, that this is not important, I am ok with that!

Cheers,

Christian