summaryrefslogtreecommitdiff
path: root/irc-client.js
diff options
context:
space:
mode:
Diffstat (limited to 'irc-client.js')
-rw-r--r--irc-client.js25
1 files changed, 17 insertions, 8 deletions
diff --git a/irc-client.js b/irc-client.js
index bd8edb8..ad21a5e 100644
--- a/irc-client.js
+++ b/irc-client.js
@@ -43,7 +43,7 @@ IrcClient.prototype.init = function(irc) {
var client = this;
this.debugLevel && irc.setDebugLevel(this.debugLevel);
irc.on('connected', function() {
- info('Connected, channels: ' + _.size(client.channels));
+ info('Connected, channels: ' + _.keys(client.channels).join(', '));
_.each(client.channels, function(channel) {
info('JOINing ' + channel.name);
irc.join(channel.name);
@@ -54,13 +54,16 @@ IrcClient.prototype.init = function(irc) {
client.connect();
});
irc.on('join', function(nick, channelName) {
- _.each(client.channels, function(channel) {
- info('JOINed ' + channel.name);
- channel.fire(channelName);
- });
+ info('JOINed ' + channelName);
+ client.getChannel(channelName).fire(channelName);
});
irc.on('privmsg', function(nick, channel, message) {
- client.emit('privmsg', nick, channel, message);
+ client.emit.call(['privmsg'].slice.apply(arguments));
+// client.emit('privmsg', nick, channel, message);
+ });
+ irc.on('topic', function() {
+ console.log('topic: ' + util.inspect(arguments));
+ client.emit.call(null, ['topic'].slice.apply(arguments));
});
return irc;
}
@@ -92,12 +95,18 @@ IrcClient.prototype.join = function(name, cb) {
c.addListener(cb);
}
if(this.connected) {
+ info('join: already connected: ' + name);
c.fire(name);
}
}
-IrcClient.prototype.notice = function(to, message) {
- this.irc.notice(to, message);
+// TODO: fix
+function dispatch(name) {
+ this.irc[name].apply(this.irc, arguments);
}
+IrcClient.prototype.notice = function() { this.irc.notice.apply(this.irc, arguments); }
+IrcClient.prototype.privmsg = function() { this.irc.privmsg.apply(this.irc, arguments); }
+IrcClient.prototype.topic = function() { this.irc.topic.apply(this.irc, arguments); }
+
module.exports.IrcClient = IrcClient;