if (raw.match(reg2)) {
// JOIN
- var chan = raw.replace(reg2, '').replace(/^:/, ''), host = raw.match(/^:([^!]+)!([^!]+)@([\w.\-_]+)/)[0].substring(1).split('!');
+ var chan = raw.replace(reg2, '').replace(/^:/, '').replace(/\s$/, ''), host = raw.match(/^:([^!]+)!([^!]+)@([\w.\-_]+)/)[0].substring(1).split('!');
var msg = '<span class="statusmessage"><time> <font color="#0f0">→</font> <b>' + host[0] + '</b> (' + host[1] + ') joined the channel.</span>';
+ debug('CHANNAME ' +chan);
var objChannel;
if(host[0] == nickname){
objChannel = Object.create(Channel).init(chan);
}
if(raw.match(/^\:.+\s353\ /)){
// NAMES
- var objChan = getChannelByName(raw.match(/ [=*@] #.+ \:/)[0].replace(/^ [=*@] /, '').replace(/ \:$/, ''));
+ var objChan = getChannelByName(raw.match(/ [=*@] (#.+) \:/)[1]);
var arrNicks = raw.split(':')[2].split(' ');
var objUser;
for(var x=0; x<arrNicks.length; x++){
if(arrNicks[x].replace(/^\s+/, '').replace(/\s+$/, '') != ""){
- objUser = Object.create(User).init(arrNicks[x].replace(/^\s+/, '').replace(/\s+$/, ''))
+ objUser = Object.create(User).init(arrNicks[x].replace(' ', ''));
objChan.addUser(objUser);
}
}
}
if(raw.match(/\:.+\s366/)){
// END NAMES
- var chan = raw.replace(/^:.+ 366 /, '').replace(/ :.+/, '').split(' ')[1].replace(/^\s+/, '').replace(/\s+$/, '');
+ var chan = raw.replace(/^:.+ 366 /, '').replace(/ :.+/, '').split(' ')[1].replace(/\s$/, '');
var objChan = getChannelByName(chan);
objChan.updateUserList();
}
// TOPIC
debug('TOPIC');
var topic = raw.replace(/^\:.+\s332\ .+\ \#[\w\_\-\^]+\ \:/, '');
- var objChan = getChannelByName(raw.replace(/^:.+ 332 /, '').replace(/ :.+/, '').split(' ')[1].replace(/\s+$/, ''));
+ var objChan = getChannelByName(raw.replace(/^:.+ 332 /, '').replace(/ :.+/, '').split(' ')[1].replace(/\s$/, ''));
objChan.setTopic(stripCodes(topic));
}
if(raw.match(/\:.+\s352/)){
msg = '<span class="logmessage"><time> Your message couldn\'t be sent to the channel';
objChan.addMessage(msg);
}
+ if(raw.match(/\:[A-Za-z0-9.]+ 001 ([A-Za-z0-9_\-\[\]\\^{}|`]+)/)){
+ nickname = raw.match(/\:[A-Za-z0-9.]+ 001 ([A-Za-z0-9_\-\[\]\\^{}|`]+)/)[1];
+ debug('NICK ' +nickname);
+ }
if(raw.match(/\:[A-Za-z0-9.]+ 3(1[1-9]|2[0-9]|30)/)){
// WHOIS
var objChan = getActiveChan();