@@ -79,16 +79,16 @@ function ChatProxy(service, webrtcModule, conn) {
79
79
extraParams = stanza . querySelector ( 'extraParams' ) ,
80
80
delay = stanza . querySelector ( 'delay' ) ,
81
81
messageId = stanza . getAttribute ( 'id' ) ,
82
+ recipient = stanza . querySelector ( 'forwarded' ) ? stanza . querySelector ( 'forwarded' ) . querySelector ( 'message' ) . getAttribute ( 'to' ) : null ,
83
+ recipientId = recipient ? self . helpers . getIdFromNode ( recipient ) : null ,
82
84
dialogId = type === 'groupchat' ? self . helpers . getDialogIdFromNode ( from ) : null ,
83
85
userId = type === 'groupchat' ? self . helpers . getIdFromResource ( from ) : self . helpers . getIdFromNode ( from ) ,
84
86
marker = delivered || read || null ;
85
87
86
-
87
88
// ignore invite messages from MUC
88
89
//
89
90
if ( invite ) return true ;
90
91
91
-
92
92
// parse extra params
93
93
var extraParamsParsed ;
94
94
if ( extraParams ) {
@@ -139,6 +139,7 @@ function ChatProxy(service, webrtcModule, conn) {
139
139
var message = {
140
140
id : messageId ,
141
141
dialog_id : dialogId ,
142
+ recipient_id : recipientId ,
142
143
type : type ,
143
144
body : ( body && body . textContent ) || null ,
144
145
extension : extraParamsParsed ? extraParamsParsed . extension : null ,
@@ -329,22 +330,31 @@ ChatProxy.prototype = {
329
330
switch ( status ) {
330
331
case Strophe . Status . ERROR :
331
332
err = Utils . getError ( 422 , 'Status.ERROR - An error has occurred' ) ;
332
- if ( typeof callback === 'function' ) callback ( err , null ) ;
333
+ if ( typeof callback === 'function' ) {
334
+ callback ( err , null ) ;
335
+ }
333
336
break ;
334
337
case Strophe . Status . CONNECTING :
335
338
Utils . QBLog ( '[ChatProxy]' , 'Status.CONNECTING' ) ;
336
339
Utils . QBLog ( '[ChatProxy]' , 'Chat Protocol - ' + ( config . chatProtocol . active === 1 ? 'BOSH' : 'WebSocket' ) ) ;
337
340
break ;
338
341
case Strophe . Status . CONNFAIL :
339
342
err = Utils . getError ( 422 , 'Status.CONNFAIL - The connection attempt failed' ) ;
340
- if ( typeof callback === 'function' ) callback ( err , null ) ;
343
+ if ( typeof callback === 'function' ) {
344
+ callback ( err , null ) ;
345
+ }
341
346
break ;
342
347
case Strophe . Status . AUTHENTICATING :
343
348
Utils . QBLog ( '[ChatProxy]' , 'Status.AUTHENTICATING' ) ;
344
349
break ;
345
350
case Strophe . Status . AUTHFAIL :
346
351
err = Utils . getError ( 401 , 'Status.AUTHFAIL - The authentication attempt failed' ) ;
347
- if ( typeof callback === 'function' ) callback ( err , null ) ;
352
+ if ( typeof callback === 'function' ) {
353
+ callback ( err , null ) ;
354
+ }
355
+ if ( self . _isDisconnected && typeof self . onReconnectFailedListener === 'function' ) {
356
+ Utils . safeCallbackCall ( self . onReconnectFailedListener , err ) ;
357
+ }
348
358
break ;
349
359
case Strophe . Status . CONNECTED :
350
360
Utils . QBLog ( '[ChatProxy]' , 'Status.CONNECTED at ' + getLocalTime ( ) ) ;
0 commit comments