@@ -809,18 +809,18 @@ function clientConnect(socket) {
809
809
case '324' :
810
810
case 'MODE' :
811
811
if ( data [ 2 ] == "MODE" ) {
812
- _target = data [ 1 ] == '324' ?data [ 3 ] . trim ( ) :data [ 2 ] . trim ( ) ;
812
+ _target = data [ 1 ] == '324' ?data [ 3 ] . trim ( ) :data [ 3 ] . trim ( ) ;
813
813
_sender = data [ 1 ] . substr ( 1 ) . split ( "!" ) [ 0 ] ;
814
- _mode = data [ 1 ] == '324' ?data [ 4 ] . trim ( ) :data [ 3 ] . trim ( ) ;
814
+ _mode = data [ 1 ] == '324' ?data [ 4 ] . trim ( ) :data [ 4 ] . trim ( ) ;
815
815
_mode = _mode . indexOf ( ":" ) != - 1 ?_mode . substr ( 1 ) :_mode ;
816
816
_mode_target = [ ] ;
817
817
if ( data [ 1 ] == '324' ) {
818
818
if ( data [ 5 ] )
819
819
_mode_target = data . slice ( 5 , data . length ) ;
820
820
}
821
821
else {
822
- if ( data [ 4 ] )
823
- _mode_target = data . slice ( 4 , data . length ) ;
822
+ if ( data [ 5 ] )
823
+ _mode_target = data . slice ( 5 , data . length ) ;
824
824
}
825
825
} else {
826
826
_target = data [ 1 ] == '324' ?data [ 3 ] . trim ( ) :data [ 2 ] . trim ( ) ;
@@ -1089,7 +1089,7 @@ function clientConnect(socket) {
1089
1089
}
1090
1090
else if ( this . channels [ _channel ] ) {
1091
1091
for ( x = 0 ; x < this . channels [ _channel ] . names . length ; x ++ )
1092
- if ( this . channels [ _channel ] . names [ x ] . replace ( "@" , "" ) . replace ( "\ +" , "" ) . replace ( "~" , "" ) . replace ( "%" , "" ) == _target )
1092
+ if ( this . channels [ _channel ] . names [ x ] . replace ( "@" , "" ) . replace ( "+" , "" ) . replace ( "~" , "" ) . replace ( "%" , "" ) == _target )
1093
1093
break ;
1094
1094
this . channels [ _channel ] . names . splice ( x , 1 ) ;
1095
1095
}
@@ -1102,7 +1102,7 @@ function clientConnect(socket) {
1102
1102
}
1103
1103
else if ( this . channels [ _target ] ) {
1104
1104
for ( x = 0 ; x < this . channels [ _target ] . names . length ; x ++ )
1105
- if ( this . channels [ _target ] . names [ x ] . replace ( "@" , "" ) . replace ( "\ +" , "" ) . replace ( "~" , "" ) . replace ( "%" , "" ) == _sender )
1105
+ if ( this . channels [ _target ] . names [ x ] . replace ( "@" , "" ) . replace ( "+" , "" ) . replace ( "~" , "" ) . replace ( "%" , "" ) == _sender )
1106
1106
break ;
1107
1107
this . channels [ _target ] . names . splice ( x , 1 ) ;
1108
1108
this . channels [ _target ] . userhosts . splice ( x , 1 ) ;
@@ -1113,9 +1113,10 @@ function clientConnect(socket) {
1113
1113
for ( key in this . channels ) {
1114
1114
if ( this . channels . hasOwnProperty ( key ) ) {
1115
1115
for ( x = 0 ; x < this . channels [ key ] . names . length ; x ++ )
1116
- if ( this . channels [ key ] . names [ x ] . replace ( "@" , "" ) . replace ( "\ +" , "" ) . replace ( "~" , "" ) . replace ( "%" , "" ) == _sender )
1116
+ if ( this . channels [ key ] . names [ x ] . replace ( "@" , "" ) . replace ( "+" , "" ) . replace ( "~" , "" ) . replace ( "%" , "" ) == _sender )
1117
1117
break ;
1118
1118
this . channels [ key ] . names . splice ( x , 1 ) ;
1119
+ this . channels [ key ] . userhosts . splice ( x , 1 ) ;
1119
1120
}
1120
1121
}
1121
1122
break ;
@@ -1140,8 +1141,22 @@ function clientConnect(socket) {
1140
1141
this . _getnames [ _channel ] = false ;
1141
1142
break ;
1142
1143
case 'NICK' :
1143
- if ( data [ 1 ] . substr ( 1 ) . split ( "!" ) [ 0 ] == this . nick ) {
1144
- this . nick = data [ 3 ] . substr ( 1 ) . trim ( ) ;
1144
+ _sender = data [ 1 ] . substr ( 1 ) ;
1145
+ _new = data [ 3 ] . substr ( 1 ) . trim ( ) ;
1146
+ if ( _sender == this . nick ) {
1147
+ this . nick = _new ;
1148
+ }
1149
+ for ( key in this . channels ) {
1150
+ if ( this . channels . hasOwnProperty ( key ) ) {
1151
+ for ( x = 0 ; x < this . channels [ key ] . names . length ; x ++ ) {
1152
+ _statut = ( / ( @ | % | \+ ) / . test ( this . channels [ key ] . names [ x ] . substr ( 0 , 1 ) ) ? this . channels [ key ] . names [ x ] . substr ( 0 , 1 ) : "" ) ;
1153
+ if ( this . channels [ key ] . names [ x ] . replace ( "@" , "" ) . replace ( "+" , "" ) . replace ( "~" , "" ) . replace ( "%" , "" ) == _sender ) {
1154
+ this . channels [ key ] . names . splice ( x , 1 ) ;
1155
+ this . channels [ key ] . names . push ( _statut + _new ) ;
1156
+ break ;
1157
+ }
1158
+ }
1159
+ }
1145
1160
}
1146
1161
break ;
1147
1162
case '433' :
0 commit comments