Skip to content

Commit

Permalink
[minor] Added 'selfMessage' event support, miscellaneous small improv…
Browse files Browse the repository at this point in the history
…ements
  • Loading branch information
AvianFlu committed Jul 2, 2011
1 parent b817f31 commit 136b19b
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions lib/irc.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,25 @@ var IRC = exports.IRC = function(options){
self.ircClient = new ircModule.Client(
self.server,
self.nick,
self.channels,
self.showErrors,
self.userName,
self.realName
{
channels: self.channels,
showErrors: self.showErrors,
userName: self.userName,
realName: self.realName
}
);

self.ircClient.on('motd', function (motd) {
self.emit('o.ircConnect', 'Connected successfully!');
console.log('hook.io-irc has successfully connected to IRC.');
//console.log(self.userName, self.realName);
if (self.shell) { shell(); }
});

self.ircClient.on('invite', function (channel, from) {
self.ircClient.join(channel, function () {
self.ircClient.say(from, 'Thanks for the invite!');
self.emit('o.invited', 'I have joined ' + channel + ' at the request of ' + from + '.');
});
});

Expand Down Expand Up @@ -69,6 +73,11 @@ var IRC = exports.IRC = function(options){
self.emit('o.message', nick, to, text);
});

self.ircClient.on('selfMessage', function (to, text) {
console.log(self.nick, ':', to, ': ', text);
self.emit('o.Isaid', text, to);
})

self.on('i.say.o.say', function (fullEvent, dest, msg) {
self.ircClient.say(dest, msg);
self.emit('o.msgSent', 'Message has been sent!');
Expand Down Expand Up @@ -113,7 +122,7 @@ var IRC = exports.IRC = function(options){
command.shift();
msg = command.slice(1).join(' ');
self.ircClient.say(command[0], msg);
self.emit('o.said', msg);
//self.emit('o.said', msg);
shell();
break;
case 'join':
Expand Down

0 comments on commit 136b19b

Please sign in to comment.