Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also .

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also .
...
  • 2 commits
  • 3 files changed
  • 0 commit comments
  • 2 contributors
Commits on Jun 21, 2012
@sespindola sespindola Added startup channels 5ebd77e
Commits on Jul 04, 2012
Alex Young Merge pull request #38 from sespindola/add_startup_channels
Added startup channels
93976cd
Showing with 19 additions and 0 deletions.
  1. +4 −0 config/config.json
  2. +5 −0 doc/configuration.md
  3. +10 −0 lib/server.js
View
4 config/config.json
@@ -10,6 +10,10 @@
"opers": {
"alex": { "password": "$2a$10$T1UJYlinVUGHqfInKSZQz./CHrYIVVqbDO3N1fRNEUvFvSEcshNdC" }
},
+ "channels": {
+ "channel1": { "topic": "First Channel" },
+ "channel2": { "topic": "Second Channel" }
+ },
"links": {
"server2": { "host": "127.0.0.1",
"password": "$2a$10$T1UJYlinVUGHqfInKSZQz./CHrYIVVqbDO3N1fRNEUvFvSEcshNdC",
View
5 doc/configuration.md
@@ -11,6 +11,10 @@ This is what a configuration file looks like:
"opers": {
"alex": { "password": "5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8" }
},
+ "channels": {
+ "channel1": { "topic": "First Channel" },
+ "channel2": { "topic": "Second Channel" }
+ },
"links": {
"server2": { "host": "127.0.0.1",
"password": "5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8",
@@ -25,6 +29,7 @@ This is what a configuration file looks like:
* `port`: The port the server should listen on
* `whoWasLimit`: The number of `WHOWAS` records to store in memory
* `opers`: A list of operators with bcrypted passwords (the `pwgen.js` script can encrypt passwords for you)
+* `channels`: A list of channels that are created on startup.
* `links`: This is for other server links and can be ignored for now
## Configuration File Locations
View
10 lib/server.js
@@ -63,6 +63,7 @@ Server.boot = function() {
server.loadConfig(function() {
server.start();
+ server.createDefaultChannels();
});
process.on('SIGHUP', function() {
@@ -202,6 +203,15 @@ Server.prototype = {
return this.commands[command];
},
+ createDefaultChannels: function() {
+ var context = this;
+ if (this.config.channels) {
+ Object.keys(this.config.channels).forEach(function(channel) {
+ var newChan = context.channels.registered[context.normalizeName(channel)] = new Channel(channel, context);
+ newChan.topic = context.config.channels[channel].topic;
+ });
+ }
+ },
motd: function(user) {
user.send(this.host, irc.reply.motdStart, user.nick, ':- Message of the Day -');

No commit comments for this range

Something went wrong with that request. Please try again.