Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

autoConnect Client option #6

Merged
merged 2 commits into from
Mar 29, 2011
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions API.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,19 @@ values:
debug: false,
showErrors: false,
autoRejoin: true,
autoConnect: true,
channels: [],
secure: false
}

`secure` (SSL connection) can be a true value or an object (the kind of object returned from `crypto.createCredentials()`) specifying cert etc for validation.

Setting `autoConnect` to false prevents the Client from connecting on instantiation. You will need to call `connect()` on the client instance:

var client = new irc.Client({ autoConnect: false, ... });
client.connect();


`irc.Client` instances are an EventEmitters with the following events:

### Event: 'motd'
Expand Down
5 changes: 4 additions & 1 deletion lib/irc.js
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,7 @@ function Client(server, nick, opt) {
debug: false,
showErrors: false,
autoRejoin: true,
autoConnect: true,
channels: [],
retryCount: null,
retryDelay: 2000,
Expand All @@ -526,7 +527,9 @@ function Client(server, nick, opt) {

// TODO - fail if nick or server missing
// TODO - fail if username has a space in it
self.connect();
if (self.opt.autoConnect === true) {
self.connect();
}

self.addListener("raw", function (message) { // {{{
switch ( message.command ) {
Expand Down