@@ -805,7 +805,7 @@ function clientConnect(socket) {
805
805
}
806
806
807
807
if ( true ) {
808
- for ( let n = 0 ; n < lines . length ; n ++ ) {
808
+ for ( n = 0 ; n < lines . length ; n ++ ) {
809
809
if ( DEBUG )
810
810
console . log ( "> " + lines [ n ] ) ;
811
811
data = lines [ n ] . trim ( ) . split ( " " ) ;
@@ -862,9 +862,18 @@ function clientConnect(socket) {
862
862
continue ;
863
863
}
864
864
865
- if ( SASL && data [ 1 ] == "903" ) {
866
- this . write ( "CAP END\n" ) ;
867
- continue ;
865
+ // :irc.server 904 <nick> :SASL authentication failed
866
+ if ( data [ 1 ] == "904" ) {
867
+ if ( ! this . authenticated ) {
868
+ this . end ( ) ;
869
+ }
870
+ }
871
+
872
+ // :x 903 y :SASL authentication successful
873
+ if ( data [ 1 ] == "903" ) {
874
+ if ( ! this . authenticated ) {
875
+ this . write ( "CAP END\n" ) ;
876
+ }
868
877
}
869
878
870
879
let s = ( data [ 2 ] == "JOIN" || data [ 2 ] == "PART" || data [ 2 ] == "QUIT" || data [ 2 ] == "MODE" || data [ 2 ] == "PING" || data [ 2 ] == "NICK" || data [ 2 ] == "KICK" ? data [ 2 ] : data [ 1 ] ) ;
@@ -1207,10 +1216,14 @@ function clientConnect(socket) {
1207
1216
}
1208
1217
for ( x = 0 ; x < _names . length ; x ++ ) {
1209
1218
this . channels [ _channel ] . names . push ( _names [ x ] . trim ( ) . split ( "!" ) [ 0 ] ) ;
1210
- if ( typeof this . channels [ _channel ] . userhosts !== 'undefined' && _names [ x ] . trim ( ) . indexOf ( "!" ) >= 0 )
1219
+
1220
+ if ( typeof this . channels [ _channel ] . userhosts === 'undefined' )
1221
+ this . channels [ _channel ] . userhosts = [ ] ;
1222
+
1223
+ if ( _names [ x ] . trim ( ) . indexOf ( "!" ) >= 0 )
1211
1224
this . channels [ _channel ] . userhosts . push ( _names [ x ] . trim ( ) . split ( "!" ) [ 1 ] ) ;
1212
- /*else
1213
- this.channels[_channel].userhosts.push("*@*"); */
1225
+ /*else
1226
+ this.channels[_channel].userhosts.push("*@*"); */
1214
1227
}
1215
1228
break ;
1216
1229
case '366' :
@@ -1247,7 +1260,7 @@ function clientConnect(socket) {
1247
1260
}
1248
1261
break ;
1249
1262
}
1250
- if ( data [ 1 ] == "PING" ) {
1263
+ if ( data [ 1 ] == "PING" ) {
1251
1264
this . write ( "PONG " + data [ 2 ] . substr ( 1 ) . trim ( ) + "\n" ) ;
1252
1265
continue ;
1253
1266
}
@@ -1291,7 +1304,7 @@ function clientConnect(socket) {
1291
1304
this . parents [ x ] . end ( ) ;
1292
1305
}
1293
1306
this . buffers = false ;
1294
- delete connections [ hash ( this . nick + this . password + this . server + this . port . toString ( ) ) ] ;
1307
+ delete connections [ hash ( this . nick + this . password + this . server + this . port . toString ( ) ) ] ;
1295
1308
this . destroy ( ) ;
1296
1309
} ) ;
1297
1310
connection . on ( 'error' , function ( err ) {
0 commit comments