Skip to content

Commit

Permalink
Merge branch 'jirwin/fix-unrealircd-auditorium'
Browse files Browse the repository at this point in the history
Thanks PNWebster!
  • Loading branch information
jirwin committed Apr 15, 2015
2 parents a29e052 + 9133e9d commit 31bc7d8
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/irc.js
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ function Client(server, nick, opt) {
// channel user modes
var user = modeArgs.shift();
if (adding) {
if (channel.users[user].indexOf(self.prefixForMode[mode]) === -1)
if (channel.users[user] && channel.users[user].indexOf(self.prefixForMode[mode]) === -1)
channel.users[user] += self.prefixForMode[mode];

self.emit('+mode', message.args[0], message.nick, mode, user, message);
Expand Down
36 changes: 36 additions & 0 deletions test/test-auditorium.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
var net = require('net');

var irc = require('../lib/irc');
var test = require('tape');

var testHelpers = require('./helpers');

test('user gets opped in auditorium', function(t) {
var mock = testHelpers.MockIrcd();
var client = new irc.Client('localhost', 'testbot', {debug: true});

client.on('+mode', function(channel, by, mode, argument) {
if (channel == '#auditorium' && argument == 'user') {
client.disconnect();
}
});

mock.server.on('connection', function() {
// Initiate connection
mock.send(':localhost 001 testbot :Welcome to the Internet Relay Chat Network testbot\r\n');

// Set prefix modes
mock.send(':localhost 005 testbot PREFIX=(ov)@+ CHANTYPES=#& :are supported by this server\r\n');

// Force join into auditorium
mock.send(':testbot JOIN #auditorium\r\n');

// +o the invisible user
mock.send(':ChanServ MODE #auditorium +o user\r\n');
});

mock.on('end', function() {
mock.close();
t.end();
});
});

0 comments on commit 31bc7d8

Please sign in to comment.