quickblox 2.15.2 → 2.15.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/quickblox.js CHANGED
@@ -45359,7 +45359,7 @@ if (Utils.getEnv().browser) {
45359
45359
  Strophe.addNamespace('CHAT_STATES', chatUtils.MARKERS.STATES);
45360
45360
  } else if (Utils.getEnv().nativescript) {
45361
45361
  XMPP = require('nativescript-xmpp-client');
45362
- } else if (Utils.getEnv().node) {
45362
+ } else if (Utils.getEnv().node) {
45363
45363
  XMPP = require('node-xmpp-client');
45364
45364
  }
45365
45365
 
@@ -45405,7 +45405,7 @@ function ChatProxy(service) {
45405
45405
  },
45406
45406
  'autostart': false
45407
45407
  });
45408
- // node-xmpp-client
45408
+ // node-xmpp-client
45409
45409
  } else if (Utils.getEnv().node) {
45410
45410
  self.Client = new XMPP({
45411
45411
  'autostart': false
@@ -45415,7 +45415,7 @@ function ChatProxy(service) {
45415
45415
  // override 'send' function to add some logs
45416
45416
  originSendFunction = self.Client.send;
45417
45417
 
45418
- self.Client.send = function(stanza) {
45418
+ self.Client.send = function (stanza) {
45419
45419
  Utils.QBLog('[QBChat]', 'SENT:', stanza.toString());
45420
45420
  originSendFunction.call(self.Client, stanza);
45421
45421
  };
@@ -45433,7 +45433,7 @@ function ChatProxy(service) {
45433
45433
 
45434
45434
  this._checkConnectionTimer = undefined;
45435
45435
  this._checkConnectionPingTimer = undefined;
45436
- this._localPingFaildCounter = 0;
45436
+ this._chatPingFailedCounter = 0;
45437
45437
  this._onlineStatus = true;
45438
45438
  this._checkExpiredSessionTimer = undefined;
45439
45439
  this._sessionHasExpired = false;
@@ -45455,10 +45455,10 @@ function ChatProxy(service) {
45455
45455
  //
45456
45456
  this.chatUtils = chatUtils;
45457
45457
 
45458
- if (config.streamManagement.enable){
45458
+ if (config.streamManagement.enable) {
45459
45459
  if (config.chatProtocol.active === 2) {
45460
45460
  this.streamManagement = new StreamManagement(config.streamManagement);
45461
- self._sentMessageCallback = function(messageLost, messageSent) {
45461
+ self._sentMessageCallback = function (messageLost, messageSent) {
45462
45462
  if (typeof self.onSentMessageCallback === 'function') {
45463
45463
  if (messageSent) {
45464
45464
  self.onSentMessageCallback(null, messageSent);
@@ -45495,61 +45495,61 @@ function ChatProxy(service) {
45495
45495
  */
45496
45496
 
45497
45497
  /**
45498
- * You need to set onMessageListener function, to get messages({@link https://docs.quickblox.com/docs/js-chat-messaging#subscribe-message-events read more}).
45498
+ * You need to set onMessageListener function, to get messages. {@link https://quickblox.com/developers/Web_XMPP_Chat_Sample#Create_new_dialog More info.}
45499
45499
  * @function onMessageListener
45500
45500
  * @memberOf QB.chat
45501
- * @param {Number} userId - Sender id.
45502
- * @param {Object} message - The message model object.
45501
+ * @param {Number} userId - Sender id
45502
+ * @param {Object} message - The message model object
45503
45503
  **/
45504
45504
 
45505
45505
  /**
45506
- * Blocked entities receive an error when try to chat with a user in a 1-1 chat and receivie nothing in a group chat.
45506
+ * Blocked entities receive an error when try to chat with a user in a 1-1 chat and receivie nothing in a group chat. {@link https://quickblox.com/developers/Web_XMPP_Chat_Sample#Blocked_user_attempts_to_communicate_with_user More info.}
45507
45507
  * @function onMessageErrorListener
45508
45508
  * @memberOf QB.chat
45509
- * @param {Number} messageId - The message id.
45510
- * @param {Object} error - The error object.
45509
+ * @param {Number} messageId - The message id
45510
+ * @param {Object} error - The error object
45511
45511
  **/
45512
45512
 
45513
45513
  /**
45514
- * This feature defines an approach for ensuring is the message delivered to the server. This feature is unabled by default({@link https://docs.quickblox.com/docs/js-chat-messaging#check-if-a-message-is-sent read more}).
45514
+ * This feature defines an approach for ensuring is the message delivered to the server. This feature is unabled by default. {@link https://quickblox.com/developers/Web_XMPP_Chat_Sample#Sent_message More info.}
45515
45515
  * @function onSentMessageCallback
45516
45516
  * @memberOf QB.chat
45517
- * @param {Object} messageLost - The lost message model object (Fail).
45518
- * @param {Object} messageSent - The sent message model object (Success).
45517
+ * @param {Object} messageLost - The lost message model object (Fail)
45518
+ * @param {Object} messageSent - The sent message model object (Success)
45519
45519
  **/
45520
45520
 
45521
45521
  /**
45522
- * Show typing status in chat or groupchat({@link https://docs.quickblox.com/docs/js-chat-messaging#send-typing-indicators read more}).
45522
+ * Show typing status in chat or groupchat. {@link https://quickblox.com/developers/Web_XMPP_Chat_Sample#Typing_status More info.}
45523
45523
  * @function onMessageTypingListener
45524
45524
  * @memberOf QB.chat
45525
- * @param {Boolean} isTyping - Typing Status (true - typing, false - stop typing).
45526
- * @param {Number} userId - Typing user id.
45527
- * @param {String} dialogId - The dialog id.
45525
+ * @param {Boolean} isTyping - Typing Status (true - typing, false - stop typing)
45526
+ * @param {Number} userId - Typing user id
45527
+ * @param {String} dialogId - The dialog id
45528
45528
  **/
45529
45529
 
45530
45530
  /**
45531
- * Receive delivery confirmations({@link https://docs.quickblox.com/docs/js-chat-messaging#mark-message-as-delivered read more}).
45531
+ * Receive delivery confirmations {@link https://quickblox.com/developers/Web_XMPP_Chat_Sample#Delivered_status More info.}
45532
45532
  * @function onDeliveredStatusListener
45533
45533
  * @memberOf QB.chat
45534
- * @param {String} messageId - Delivered message id.
45535
- * @param {String} dialogId - The dialog id.
45536
- * @param {Number} userId - User id.
45534
+ * @param {String} messageId - Delivered message id
45535
+ * @param {String} dialogId - The dialog id
45536
+ * @param {Number} userId - User id
45537
45537
  **/
45538
45538
 
45539
45539
  /**
45540
- * You can manage 'read' notifications in chat({@link https://docs.quickblox.com/docs/js-chat-messaging#mark-message-as-read read more}).
45540
+ * You can manage 'read' notifications in chat. {@link https://quickblox.com/developers/Web_XMPP_Chat_Sample#Read_status More info.}
45541
45541
  * @function onReadStatusListener
45542
45542
  * @memberOf QB.chat
45543
- * @param {String} messageId - Read message id.
45544
- * @param {String} dialogId - The dialog id.
45545
- * @param {Number} userId - User Id.
45543
+ * @param {String} messageId - Read message id
45544
+ * @param {String} dialogId - The dialog id
45545
+ * @param {Number} userId - User Id
45546
45546
  **/
45547
45547
 
45548
45548
  /**
45549
- * These messages work over separated channel and won't be mixed with the regular chat messages({@link https://docs.quickblox.com/docs/js-chat-messaging#send-system-messages read more}).
45549
+ * These messages work over separated channel and won't be mixed with the regular chat messages. {@link https://quickblox.com/developers/Web_XMPP_Chat_Sample#System_notifications More info.}
45550
45550
  * @function onSystemMessageListener
45551
45551
  * @memberOf QB.chat
45552
- * @param {Object} message - The system message model object. Always have type: 'headline'.
45552
+ * @param {Object} message - The system message model object. Always have type: 'headline'
45553
45553
  **/
45554
45554
 
45555
45555
  /**
@@ -45577,56 +45577,56 @@ function ChatProxy(service) {
45577
45577
  **/
45578
45578
 
45579
45579
  /**
45580
- * Receive user status (online / offline)({@link https://docs.quickblox.com/docs/js-chat-contact-list#contact-list-updates read more}).
45580
+ * Receive user status (online / offline). {@link https://quickblox.com/developers/Web_XMPP_Chat_Sample#Roster_callbacks More info.}
45581
45581
  * @function onContactListListener
45582
45582
  * @memberOf QB.chat
45583
- * @param {Number} userId - The sender ID.
45584
- * @param {String} type - If user leave the chat, type will be 'unavailable'.
45583
+ * @param {Number} userId - The sender ID
45584
+ * @param {String} type - If user leave the chat, type will be 'unavailable'
45585
45585
  **/
45586
45586
 
45587
45587
  /**
45588
- * Receive subscription request({@link https://docs.quickblox.com/docs/js-chat-contact-list#add-user-to-your-contact-list read more}).
45588
+ * Receive subscription request. {@link https://quickblox.com/developers/Web_XMPP_Chat_Sample#Roster_callbacks More info.}
45589
45589
  * @function onSubscribeListener
45590
45590
  * @memberOf QB.chat
45591
- * @param {Number} userId - The sender ID.
45591
+ * @param {Number} userId - The sender ID
45592
45592
  **/
45593
45593
 
45594
45594
  /**
45595
- * Receive confirm request({@link https://docs.quickblox.com/docs/js-chat-contact-list#confirm-the-contact-request read more}).
45595
+ * Receive confirm request. {@link https://quickblox.com/developers/Web_XMPP_Chat_Sample#Roster_callbacks More info.}
45596
45596
  * @function onConfirmSubscribeListener
45597
45597
  * @memberOf QB.chat
45598
45598
  * @param {Number} userId - The sender ID
45599
45599
  **/
45600
45600
 
45601
45601
  /**
45602
- * Receive reject request({@link https://docs.quickblox.com/docs/js-chat-contact-list#reject-the-contact-request read more}).
45602
+ * Receive reject request. {@link https://quickblox.com/developers/Web_XMPP_Chat_Sample#Roster_callbacks More info.}
45603
45603
  * @function onRejectSubscribeListener
45604
45604
  * @memberOf QB.chat
45605
45605
  * @param {Number} userId - The sender ID
45606
45606
  **/
45607
45607
 
45608
45608
  /**
45609
- * Receive user's last activity (time ago).
45609
+ * Receive user's last activity (time ago). {@link https://xmpp.org/extensions/xep-0012.html More info.}
45610
45610
  * @function onLastUserActivityListener
45611
45611
  * @memberOf QB.chat
45612
- * @param {Number} userId - The user's ID which last activity time we receive.
45613
- * @param {Number} seconds - Time ago (last activity in seconds or 0 if user online or undefined if user never registered in chat).
45612
+ * @param {Number} userId - The user's ID which last activity time we receive
45613
+ * @param {Number} seconds - Time ago (last activity in seconds or 0 if user online or undefined if user never registered in chat)
45614
45614
  */
45615
45615
 
45616
45616
  /**
45617
- * Run after disconnect from chat({@linkhttps://docs.quickblox.com/docs/js-chat-connection#disconnect-from-chat-server read more}).
45617
+ * Run after disconnect from chat. {@link https://quickblox.com/developers/Web_XMPP_Chat_Sample#Logout_from_Chat More info.}
45618
45618
  * @function onDisconnectedListener
45619
45619
  * @memberOf QB.chat
45620
45620
  **/
45621
45621
 
45622
45622
  /**
45623
- * By default Javascript SDK reconnects automatically when connection to server is lost({@link https://docs.quickblox.com/docs/js-chat-connection#reconnection read more}).
45623
+ * By default Javascript SDK reconnects automatically when connection to server is lost. {@link https://quickblox.com/developers/Web_XMPP_Chat_Sample#Reconnection More info.}
45624
45624
  * @function onReconnectListener
45625
45625
  * @memberOf QB.chat
45626
45626
  **/
45627
45627
 
45628
45628
 
45629
- this._onMessage = function(stanza) {
45629
+ this._onMessage = function (stanza) {
45630
45630
  var from = chatUtils.getAttr(stanza, 'from'),
45631
45631
  to = chatUtils.getAttr(stanza, 'to'),
45632
45632
  type = chatUtils.getAttr(stanza, 'type'),
@@ -45666,16 +45666,16 @@ function ChatProxy(service) {
45666
45666
  // ignore invite messages from MUC
45667
45667
  if (invite) return true;
45668
45668
 
45669
- if(extraParams) {
45669
+ if (extraParams) {
45670
45670
  extraParamsParsed = chatUtils.parseExtraParams(extraParams);
45671
45671
 
45672
- if(extraParamsParsed.dialogId){
45672
+ if (extraParamsParsed.dialogId) {
45673
45673
  dialogId = extraParamsParsed.dialogId;
45674
45674
  }
45675
45675
  }
45676
45676
 
45677
- if(composing || paused){
45678
- if (typeof self.onMessageTypingListener === 'function' && (type === 'chat' || type === 'groupchat' || !delay)){
45677
+ if (composing || paused) {
45678
+ if (typeof self.onMessageTypingListener === 'function' && (type === 'chat' || type === 'groupchat' || !delay)) {
45679
45679
  Utils.safeCallbackCall(self.onMessageTypingListener, !!composing, userId, dialogId);
45680
45680
  }
45681
45681
 
@@ -45721,7 +45721,7 @@ function ChatProxy(service) {
45721
45721
  message.markable = 1;
45722
45722
  }
45723
45723
 
45724
- if (typeof self.onMessageListener === 'function' && (type === 'chat' || type === 'groupchat')){
45724
+ if (typeof self.onMessageListener === 'function' && (type === 'chat' || type === 'groupchat')) {
45725
45725
  Utils.safeCallbackCall(self.onMessageListener, userId, message);
45726
45726
  }
45727
45727
 
@@ -45730,7 +45730,7 @@ function ChatProxy(service) {
45730
45730
  return true;
45731
45731
  };
45732
45732
 
45733
- this._onPresence = function(stanza) {
45733
+ this._onPresence = function (stanza) {
45734
45734
  var from = chatUtils.getAttr(stanza, 'from'),
45735
45735
  to = chatUtils.getAttr(stanza, 'to'),
45736
45736
  id = chatUtils.getAttr(stanza, 'id'),
@@ -45739,22 +45739,22 @@ function ChatProxy(service) {
45739
45739
  x = chatUtils.getElement(stanza, 'x'),
45740
45740
  xXMLNS, status, statusCode, dialogId, userId;
45741
45741
 
45742
- if(x){
45742
+ if (x) {
45743
45743
  xXMLNS = chatUtils.getAttr(x, 'xmlns');
45744
45744
  status = chatUtils.getElement(x, 'status');
45745
- if(status){
45745
+ if (status) {
45746
45746
  statusCode = chatUtils.getAttr(status, 'code');
45747
45747
  }
45748
45748
  }
45749
45749
 
45750
45750
  // MUC presences go here
45751
- if(xXMLNS && xXMLNS == "http://jabber.org/protocol/muc#user"){
45751
+ if (xXMLNS && xXMLNS == "http://jabber.org/protocol/muc#user") {
45752
45752
  dialogId = self.helpers.getDialogIdFromNode(from);
45753
45753
  userId = self.helpers.getUserIdFromRoomJid(from);
45754
45754
 
45755
45755
  // KICK from dialog event
45756
- if(status && statusCode == "301"){
45757
- if (typeof self.onKickOccupant === 'function'){
45756
+ if (status && statusCode == "301") {
45757
+ if (typeof self.onKickOccupant === 'function') {
45758
45758
  var actorElement = chatUtils.getElement(chatUtils.getElement(x, 'item'), 'actor');
45759
45759
  var initiatorUserJid = chatUtils.getAttr(actorElement, 'jid');
45760
45760
  Utils.safeCallbackCall(self.onKickOccupant,
@@ -45767,17 +45767,17 @@ function ChatProxy(service) {
45767
45767
  return true;
45768
45768
 
45769
45769
  // Occupants JOIN/LEAVE events
45770
- }else if(!status){
45771
- if(userId != currentUserId){
45770
+ } else if (!status) {
45771
+ if (userId != currentUserId) {
45772
45772
  // Leave
45773
- if(type && type === 'unavailable'){
45774
- if (typeof self.onLeaveOccupant === 'function'){
45773
+ if (type && type === 'unavailable') {
45774
+ if (typeof self.onLeaveOccupant === 'function') {
45775
45775
  Utils.safeCallbackCall(self.onLeaveOccupant, dialogId, parseInt(userId));
45776
45776
  }
45777
45777
  return true;
45778
45778
  // Join
45779
- }else{
45780
- if(typeof self.onJoinOccupant === 'function'){
45779
+ } else {
45780
+ if (typeof self.onJoinOccupant === 'function') {
45781
45781
  Utils.safeCallbackCall(self.onJoinOccupant, dialogId, parseInt(userId));
45782
45782
  }
45783
45783
  return true;
@@ -45787,18 +45787,18 @@ function ChatProxy(service) {
45787
45787
  }
45788
45788
  }
45789
45789
 
45790
- if(!Utils.getEnv().browser) {
45790
+ if (!Utils.getEnv().browser) {
45791
45791
  /** MUC */
45792
- if(xXMLNS){
45793
- if(xXMLNS == "http://jabber.org/protocol/muc#user"){
45792
+ if (xXMLNS) {
45793
+ if (xXMLNS == "http://jabber.org/protocol/muc#user") {
45794
45794
  /**
45795
45795
  * if you make 'leave' from dialog
45796
45796
  * stanza will be contains type="unavailable"
45797
45797
  */
45798
- if(type && type === 'unavailable'){
45798
+ if (type && type === 'unavailable') {
45799
45799
  /** LEAVE from dialog */
45800
- if(status && statusCode == "110"){
45801
- if(typeof self.nodeStanzasCallbacks['muc:leave'] === 'function') {
45800
+ if (status && statusCode == "110") {
45801
+ if (typeof self.nodeStanzasCallbacks['muc:leave'] === 'function') {
45802
45802
  Utils.safeCallbackCall(self.nodeStanzasCallbacks['muc:leave'], null);
45803
45803
  }
45804
45804
  }
@@ -45807,8 +45807,8 @@ function ChatProxy(service) {
45807
45807
  }
45808
45808
 
45809
45809
  /** JOIN to dialog success */
45810
- if(id.endsWith(":join") && status && statusCode == "110"){
45811
- if(typeof self.nodeStanzasCallbacks[id] === 'function') {
45810
+ if (id.endsWith(":join") && status && statusCode == "110") {
45811
+ if (typeof self.nodeStanzasCallbacks[id] === 'function') {
45812
45812
  self.nodeStanzasCallbacks[id](stanza);
45813
45813
  }
45814
45814
 
@@ -45816,10 +45816,10 @@ function ChatProxy(service) {
45816
45816
  }
45817
45817
 
45818
45818
  // an error
45819
- } else if(type && type === 'error' && xXMLNS == "http://jabber.org/protocol/muc"){
45819
+ } else if (type && type === 'error' && xXMLNS == "http://jabber.org/protocol/muc") {
45820
45820
  /** JOIN to dialog error */
45821
- if(id.endsWith(":join")){
45822
- if(typeof self.nodeStanzasCallbacks[id] === 'function') {
45821
+ if (id.endsWith(":join")) {
45822
+ if (typeof self.nodeStanzasCallbacks[id] === 'function') {
45823
45823
  self.nodeStanzasCallbacks[id](stanza);
45824
45824
  }
45825
45825
  }
@@ -45835,7 +45835,7 @@ function ChatProxy(service) {
45835
45835
  userId = self.helpers.getIdFromNode(from);
45836
45836
 
45837
45837
  if (!type) {
45838
- if (typeof self.onContactListListener === 'function' && self.roster.contacts[userId] && self.roster.contacts[userId].subscription !== 'none'){
45838
+ if (typeof self.onContactListListener === 'function' && self.roster.contacts[userId] && self.roster.contacts[userId].subscription !== 'none') {
45839
45839
  Utils.safeCallbackCall(self.onContactListListener, userId);
45840
45840
  }
45841
45841
  } else {
@@ -45869,7 +45869,7 @@ function ChatProxy(service) {
45869
45869
  ask: null
45870
45870
  };
45871
45871
 
45872
- if (typeof self.onConfirmSubscribeListener === 'function'){
45872
+ if (typeof self.onConfirmSubscribeListener === 'function') {
45873
45873
  Utils.safeCallbackCall(self.onConfirmSubscribeListener, userId);
45874
45874
  }
45875
45875
  }
@@ -45899,10 +45899,10 @@ function ChatProxy(service) {
45899
45899
 
45900
45900
  // send initial presence if one of client (instance) goes offline
45901
45901
  if (userId === currentUserId) {
45902
- if(Utils.getEnv().browser){
45902
+ if (Utils.getEnv().browser) {
45903
45903
  self.connection.send($pres());
45904
45904
  } else {
45905
- self.Client.send(chatUtils.createStanza(XMPP.Stanza, null,'presence'));
45905
+ self.Client.send(chatUtils.createStanza(XMPP.Stanza, null, 'presence'));
45906
45906
  }
45907
45907
  }
45908
45908
 
@@ -45915,7 +45915,7 @@ function ChatProxy(service) {
45915
45915
  return true;
45916
45916
  };
45917
45917
 
45918
- this._onIQ = function(stanza) {
45918
+ this._onIQ = function (stanza) {
45919
45919
  var stanzaId = chatUtils.getAttr(stanza, 'id');
45920
45920
  var isLastActivity = stanzaId.indexOf('lastActivity') > -1;
45921
45921
  var isPong = stanzaId.indexOf('ping') > -1;
@@ -45944,7 +45944,7 @@ function ChatProxy(service) {
45944
45944
  type: 'result'
45945
45945
  };
45946
45946
  var pongStanza = chatUtils.createStanza(builder, pongParams, 'iq');
45947
- if(Utils.getEnv().browser) {
45947
+ if (Utils.getEnv().browser) {
45948
45948
  self.connection.send(pongStanza);
45949
45949
  } else {
45950
45950
  self.Client.send(pongStanza);
@@ -45974,7 +45974,7 @@ function ChatProxy(service) {
45974
45974
  return true;
45975
45975
  };
45976
45976
 
45977
- this._onSystemMessageListener = function(stanza) {
45977
+ this._onSystemMessageListener = function (stanza) {
45978
45978
  var from = chatUtils.getAttr(stanza, 'from'),
45979
45979
  to = chatUtils.getAttr(stanza, 'to'),
45980
45980
  messageId = chatUtils.getAttr(stanza, 'id'),
@@ -45995,7 +45995,7 @@ function ChatProxy(service) {
45995
45995
  };
45996
45996
 
45997
45997
  Utils.safeCallbackCall(self.onSystemMessageListener, message);
45998
- } else if(self.webrtcSignalingProcessor && !delay && moduleIdentifier === 'WebRTCVideoChat'){
45998
+ } else if (self.webrtcSignalingProcessor && !delay && moduleIdentifier === 'WebRTCVideoChat') {
45999
45999
  self.webrtcSignalingProcessor._onMessage(from, extraParams, delay, userId, extraParamsParsed.extension);
46000
46000
  }
46001
46001
 
@@ -46006,7 +46006,7 @@ function ChatProxy(service) {
46006
46006
  return true;
46007
46007
  };
46008
46008
 
46009
- this._onMessageErrorListener = function(stanza) {
46009
+ this._onMessageErrorListener = function (stanza) {
46010
46010
  // <error code="503" type="cancel">
46011
46011
  // <service-unavailable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/>
46012
46012
  // <text xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" xml:lang="en">Service not available.</text>
@@ -46032,20 +46032,20 @@ function ChatProxy(service) {
46032
46032
  ChatProxy.prototype = {
46033
46033
 
46034
46034
  /**
46035
- * self.connection to the chat({@link https://docs.quickblox.com/docs/js-chat-connection#connect-to-chat-server read more})
46035
+ * self.connection to the chat. {@link https://quickblox.com/developers/Web_XMPP_Chat_Sample#Login_to_Chat More info.}
46036
46036
  * @memberof QB.chat
46037
- * @param {Object} params - Connect to the chat parameters.
46038
- * @param {Number} params.userId - Connect to the chat by user id (use instead params.email and params.jid).
46039
- * @param {String} params.jid - Connect to the chat by user jid (use instead params.userId and params.email).
46040
- * @param {String} params.email - Connect to the chat by user's email (use instead params.userId and params.jid).
46041
- * @param {String} params.password - The user's password or session token.
46042
- * @param {chatConnectCallback} callback - The chatConnectCallback callback.
46037
+ * @param {Object} params - Connect to the chat parameters
46038
+ * @param {Number} params.userId - Connect to the chat by user id (use instead params.email and params.jid)
46039
+ * @param {String} params.jid - Connect to the chat by user jid (use instead params.userId and params.email)
46040
+ * @param {String} params.email - Connect to the chat by user's email (use instead params.userId and params.jid)
46041
+ * @param {String} params.password - The user's password or session token
46042
+ * @param {chatConnectCallback} callback - The chatConnectCallback callback
46043
46043
  * */
46044
- connect: function(params, callback) {
46044
+ connect: function (params, callback) {
46045
46045
  /**
46046
46046
  * This callback Returns error or contact list.
46047
46047
  * @callback chatConnectCallback
46048
- * @param {Object} error - The error object.
46048
+ * @param {Object} error - The error object
46049
46049
  * @param {(Object|Boolean)} response - Object of subscribed users (roster) or empty body.
46050
46050
  * */
46051
46051
  Utils.QBLog('[QBChat]', 'Connect with parameters ' + JSON.stringify(params));
@@ -46082,8 +46082,8 @@ ChatProxy.prototype = {
46082
46082
  if (Utils.getEnv().browser) {
46083
46083
  Utils.QBLog('[QBChat]', '!!---Browser env - connected--!!');
46084
46084
 
46085
- self.connection.connect(userJid, params.password, function(status) {
46086
- Utils.QBLog('[QBChat]', 'self.connection.connect called with status '+ status);
46085
+ self.connection.connect(userJid, params.password, function (status) {
46086
+ Utils.QBLog('[QBChat]', 'self.connection.connect called with status ' + status);
46087
46087
  switch (status) {
46088
46088
  case Strophe.Status.ERROR:
46089
46089
  self.isConnected = false;
@@ -46099,13 +46099,13 @@ ChatProxy.prototype = {
46099
46099
  case Strophe.Status.CONNFAIL:
46100
46100
  self.isConnected = false;
46101
46101
  self._isConnecting = false;
46102
-
46102
+
46103
46103
  err = Utils.getError(422, 'Status.CONNFAIL - The connection attempt failed', 'QBChat');
46104
-
46104
+
46105
46105
  if (isInitialConnect) {
46106
46106
  callback(err, null);
46107
46107
  }
46108
-
46108
+
46109
46109
  break;
46110
46110
  case Strophe.Status.AUTHENTICATING:
46111
46111
  Utils.QBLog('[QBChat]', 'Status.AUTHENTICATING');
@@ -46114,28 +46114,28 @@ ChatProxy.prototype = {
46114
46114
  case Strophe.Status.AUTHFAIL:
46115
46115
  self.isConnected = false;
46116
46116
  self._isConnecting = false;
46117
-
46117
+
46118
46118
  err = Utils.getError(401, 'Status.AUTHFAIL - The authentication attempt failed', 'QBChat');
46119
-
46119
+
46120
46120
  if (isInitialConnect) {
46121
46121
  callback(err, null);
46122
46122
  }
46123
-
46124
- if(!self.isConnected && typeof self.onReconnectFailedListener === 'function'){
46123
+
46124
+ if (!self.isConnected && typeof self.onReconnectFailedListener === 'function') {
46125
46125
  Utils.safeCallbackCall(self.onReconnectFailedListener, err);
46126
46126
  }
46127
-
46127
+
46128
46128
  break;
46129
46129
  case Strophe.Status.CONNECTING:
46130
46130
  Utils.QBLog('[QBChat]', 'Status.CONNECTING', '(Chat Protocol - ' + (config.chatProtocol.active === 1 ? 'BOSH' : 'WebSocket' + ')'));
46131
-
46131
+
46132
46132
  break;
46133
46133
  case Strophe.Status.CONNECTED:
46134
46134
  // Remove any handlers that might exist from a previous connection via
46135
46135
  // extension method added to the connection on initialization in qbMain.
46136
46136
  // NOTE: streamManagement also adds handlers, so do this first.
46137
46137
  self.connection.XDeleteHandlers();
46138
-
46138
+
46139
46139
  self.connection.XAddTrackedHandler(self._onMessage, null, 'message', 'chat');
46140
46140
  self.connection.XAddTrackedHandler(self._onMessage, null, 'message', 'groupchat');
46141
46141
  self.connection.XAddTrackedHandler(self._onPresence, null, 'presence');
@@ -46147,18 +46147,18 @@ ChatProxy.prototype = {
46147
46147
  noTimerId = config.pingLocalhostTimeInterval === 0 ? false : noTimerId;
46148
46148
 
46149
46149
  if (noTimerId) {
46150
- Utils.QBLog('[QBChat]', 'Init ping to localhost at ', Utils.getCurrentTime());
46151
- self._checkConnectionPingTimer = setInterval(function() {
46150
+ Utils.QBLog('[QBChat]', 'Init ping to chat at ', Utils.getCurrentTime());
46151
+ self._checkConnectionPingTimer = setInterval(function () {
46152
46152
  try {
46153
- self.pinglocalhost(function (error) {
46153
+ self.pingchat(function (error) {
46154
46154
  if (error) {
46155
46155
  Utils.QBLog('[QBChat]',
46156
- 'Local Ping: ',
46156
+ 'Chat Ping: ',
46157
46157
  'failed, at ', Utils.getCurrentTime(),
46158
- '_localPingFaildCounter: ', self._localPingFaildCounter,
46158
+ '_chatPingFailedCounter: ', self._chatPingFailedCounter,
46159
46159
  ' error: ', error);
46160
46160
  self._localPingFaildCounter += 1;
46161
- if (self._localPingFaildCounter > 6) {
46161
+ if (self._chatPingFailedCounter > 6) {
46162
46162
  self.isConnected = false;
46163
46163
  self._isConnecting = false;
46164
46164
  self._localPingFaildCounter = 0;
@@ -46166,16 +46166,15 @@ ChatProxy.prototype = {
46166
46166
  }
46167
46167
  } else {
46168
46168
  Utils.QBLog('[QBChat]',
46169
- 'Local Ping: ',
46169
+ 'Chat Ping: ',
46170
46170
  'ok, at ', Utils.getCurrentTime(),
46171
- '_localPingFaildCounter: ', self._localPingFaildCounter);
46171
+ '_chatPingFailedCounter: ', self._chatPingFailedCounter);
46172
46172
  self._localPingFaildCounter = 0;
46173
46173
  }
46174
46174
  });
46175
- }
46176
- catch (err) {
46175
+ } catch (err) {
46177
46176
  Utils.QBLog('[QBChat]',
46178
- 'Local Ping: ',
46177
+ 'Chat Ping: ',
46179
46178
  'Exception, at ', Utils.getCurrentTime(),
46180
46179
  ', detail info: ', err);
46181
46180
  }
@@ -46186,7 +46185,7 @@ ChatProxy.prototype = {
46186
46185
  var noExpiredSessionTimerId = typeof self._checkExpiredSessionTimer === 'undefined';
46187
46186
  if (noExpiredSessionTimerId) {
46188
46187
  Utils.QBLog('[QBChat]', 'Init timer for check session expired at ', ((new Date()).toTimeString().split(' ')[0]));
46189
- self._checkExpiredSessionTimer = setInterval(function() {
46188
+ self._checkExpiredSessionTimer = setInterval(function () {
46190
46189
  var timeNow = new Date();
46191
46190
  if (typeof config.qbTokenExpirationDate !== 'undefined') {
46192
46191
  var timeLag = Math.round((timeNow.getTime() - config.qbTokenExpirationDate.getTime()) / (1000 * 60));
@@ -46201,7 +46200,7 @@ ChatProxy.prototype = {
46201
46200
  }
46202
46201
  }
46203
46202
 
46204
- self._postConnectActions(function(roster) {
46203
+ self._postConnectActions(function (roster) {
46205
46204
  callback(null, roster);
46206
46205
  }, isInitialConnect);
46207
46206
 
@@ -46213,7 +46212,7 @@ ChatProxy.prototype = {
46213
46212
  Utils.QBLog('[QBChat]', 'Status.DISCONNECTED at ' + chatUtils.getLocalTime());
46214
46213
 
46215
46214
  // fire 'onDisconnectedListener' only once
46216
- if (self.isConnected && typeof self.onDisconnectedListener === 'function'){
46215
+ if (self.isConnected && typeof self.onDisconnectedListener === 'function') {
46217
46216
  Utils.safeCallbackCall(self.onDisconnectedListener);
46218
46217
  }
46219
46218
 
@@ -46233,26 +46232,26 @@ ChatProxy.prototype = {
46233
46232
  }
46234
46233
 
46235
46234
  /** connect for node */
46236
- if(!Utils.getEnv().browser) {
46235
+ if (!Utils.getEnv().browser) {
46237
46236
  Utils.QBLog('[QBChat]', '!!--call branch code connect for node--!!');
46238
46237
  // Remove all connection handlers exist from a previous connection
46239
46238
  self.Client.removeAllListeners();
46240
46239
 
46241
- self.Client.on('connect', function() {
46240
+ self.Client.on('connect', function () {
46242
46241
  Utils.QBLog('[QBChat]', 'Status.CONNECTING', '(Chat Protocol - ' + (config.chatProtocol.active === 1 ? 'BOSH' : 'WebSocket' + ')'));
46243
46242
  });
46244
46243
 
46245
- self.Client.on('auth', function() {
46244
+ self.Client.on('auth', function () {
46246
46245
  Utils.QBLog('[QBChat]', 'Status.AUTHENTICATING');
46247
46246
  });
46248
-
46249
- self.Client.on('online', function() {
46250
- self._postConnectActions(function(roster) {
46247
+
46248
+ self.Client.on('online', function () {
46249
+ self._postConnectActions(function (roster) {
46251
46250
  callback(null, roster);
46252
46251
  }, isInitialConnect);
46253
46252
  });
46254
-
46255
- self.Client.on('stanza', function(stanza) {
46253
+
46254
+ self.Client.on('stanza', function (stanza) {
46256
46255
  Utils.QBLog('[QBChat] RECV:', stanza.toString());
46257
46256
  /**
46258
46257
  * Detect typeof incoming stanza
@@ -46262,35 +46261,35 @@ ChatProxy.prototype = {
46262
46261
  self._onPresence(stanza);
46263
46262
  } else if (stanza.is('iq')) {
46264
46263
  self._onIQ(stanza);
46265
- } else if(stanza.is('message')) {
46264
+ } else if (stanza.is('message')) {
46266
46265
  if (stanza.attrs.type === 'headline') {
46267
46266
  self._onSystemMessageListener(stanza);
46268
- } else if(stanza.attrs.type === 'error') {
46267
+ } else if (stanza.attrs.type === 'error') {
46269
46268
  self._onMessageErrorListener(stanza);
46270
46269
  } else {
46271
46270
  self._onMessage(stanza);
46272
46271
  }
46273
46272
  }
46274
46273
  });
46275
-
46276
- self.Client.on('disconnect', function() {
46274
+
46275
+ self.Client.on('disconnect', function () {
46277
46276
  Utils.QBLog('[QBChat]', 'Status.DISCONNECTED - ' + chatUtils.getLocalTime());
46278
46277
 
46279
46278
  if (typeof self.onDisconnectedListener === 'function') {
46280
46279
  Utils.safeCallbackCall(self.onDisconnectedListener);
46281
46280
  }
46282
-
46281
+
46283
46282
  self.isConnected = false;
46284
46283
  self._isConnecting = false;
46285
46284
 
46286
46285
  // reconnect to chat and enable check connection
46287
46286
  self._establishConnection(params);
46288
46287
  });
46289
-
46290
- self.Client.on('error', function() {
46288
+
46289
+ self.Client.on('error', function () {
46291
46290
  Utils.QBLog('[QBChat]', 'Status.ERROR - ' + chatUtils.getLocalTime());
46292
46291
  err = Utils.getError(422, 'Status.ERROR - An error has occurred', 'QBChat');
46293
-
46292
+
46294
46293
  if (isInitialConnect) {
46295
46294
  callback(err, null);
46296
46295
  }
@@ -46299,8 +46298,8 @@ ChatProxy.prototype = {
46299
46298
  self._isConnecting = false;
46300
46299
  });
46301
46300
 
46302
- self.Client.on('end', function() {
46303
- self.Client.removeAllListeners();
46301
+ self.Client.on('end', function () {
46302
+ self.Client.removeAllListeners();
46304
46303
  });
46305
46304
 
46306
46305
  self.Client.options.jid = userJid;
@@ -46311,7 +46310,7 @@ ChatProxy.prototype = {
46311
46310
 
46312
46311
  /**
46313
46312
  * Actions after the connection is established
46314
- *
46313
+ *
46315
46314
  * - enable stream management (the configuration setting);
46316
46315
  * - save user's JID;
46317
46316
  * - enable carbons;
@@ -46319,7 +46318,7 @@ ChatProxy.prototype = {
46319
46318
  * - recover the joined rooms and fire 'onReconnectListener' (if the reconnect);
46320
46319
  * - send initial presence to the chat server.
46321
46320
  */
46322
- _postConnectActions: function(callback, isInitialConnect) {
46321
+ _postConnectActions: function (callback, isInitialConnect) {
46323
46322
  Utils.QBLog('[QBChat]', 'Status.CONNECTED at ' + chatUtils.getLocalTime());
46324
46323
 
46325
46324
  var self = this;
@@ -46343,7 +46342,7 @@ ChatProxy.prototype = {
46343
46342
  self._enableCarbons();
46344
46343
 
46345
46344
  if (isInitialConnect) {
46346
- self.roster.get(function(contacts) {
46345
+ self.roster.get(function (contacts) {
46347
46346
  xmppClient.send(presence);
46348
46347
 
46349
46348
  self.roster.contacts = contacts;
@@ -46351,7 +46350,7 @@ ChatProxy.prototype = {
46351
46350
  });
46352
46351
  } else {
46353
46352
  var rooms = Object.keys(self.muc.joinedRooms);
46354
-
46353
+
46355
46354
  xmppClient.send(presence);
46356
46355
 
46357
46356
  Utils.QBLog('[QBChat]', 'Re-joining ' + rooms.length + " rooms...");
@@ -46366,7 +46365,7 @@ ChatProxy.prototype = {
46366
46365
  }
46367
46366
  },
46368
46367
 
46369
- _establishConnection: function(params) {
46368
+ _establishConnection: function (params) {
46370
46369
  var self = this;
46371
46370
  Utils.QBLog('[QBChat]', '_establishConnection called');
46372
46371
  if (self._isLogout || self._checkConnectionTimer) {
@@ -46374,7 +46373,7 @@ ChatProxy.prototype = {
46374
46373
  return;
46375
46374
  }
46376
46375
 
46377
- var _connect = function() {
46376
+ var _connect = function () {
46378
46377
  Utils.QBLog('[QBChat]', 'call _connect() in _establishConnection ');
46379
46378
  if (!self.isConnected && !self._isConnecting && !self._sessionHasExpired) {
46380
46379
  Utils.QBLog('[QBChat]', 'call connect() again in _establishConnection ');
@@ -46388,8 +46387,8 @@ ChatProxy.prototype = {
46388
46387
 
46389
46388
  _connect();
46390
46389
 
46391
- self._checkConnectionTimer = setInterval(function() {
46392
- Utils.QBLog('[QBChat]', 'self._checkConnectionTimer called with config.chatReconnectionTimeInterval = '+config.chatReconnectionTimeInterval);
46390
+ self._checkConnectionTimer = setInterval(function () {
46391
+ Utils.QBLog('[QBChat]', 'self._checkConnectionTimer called with config.chatReconnectionTimeInterval = ' + config.chatReconnectionTimeInterval);
46393
46392
  _connect();
46394
46393
  }, config.chatReconnectionTimeInterval * 1000);
46395
46394
  },
@@ -46410,13 +46409,13 @@ ChatProxy.prototype = {
46410
46409
  },
46411
46410
 
46412
46411
  /**
46413
- * Send message to 1 to 1 or group dialog({@link https://docs.quickblox.com/docs/js-chat-messaging#send-text-message read more}).
46412
+ * Send message to 1 to 1 or group dialog. {@link https://quickblox.com/developers/Web_XMPP_Chat_Sample#Chat_in_dialog More info.}
46414
46413
  * @memberof QB.chat
46415
- * @param {String | Number} jid_or_user_id - Use opponent id for 1 to 1 chat, and room jid for group chat.
46414
+ * @param {String | Number} jid_or_user_id - Use opponent id or jid for 1 to 1 chat, and room jid for group chat.
46416
46415
  * @param {Object} message - The message object.
46417
- * @returns {String} messageId - The current message id (was generated by SDK).
46416
+ * @returns {String} messageId - The current message id (was generated by SDK)
46418
46417
  * */
46419
- send: function(jid_or_user_id, message) {
46418
+ send: function (jid_or_user_id, message) {
46420
46419
  Utils.QBLog('[QBChat]', 'Call send ' + JSON.stringify(message));
46421
46420
  var self = this,
46422
46421
  builder = Utils.getEnv().browser ? $msg : XMPP.Stanza;
@@ -46450,8 +46449,8 @@ ChatProxy.prototype = {
46450
46449
  stanza = chatUtils.filledExtraParams(stanza, message.extension);
46451
46450
  }
46452
46451
 
46453
- if(Utils.getEnv().browser) {
46454
- if(config.streamManagement.enable){
46452
+ if (Utils.getEnv().browser) {
46453
+ if (config.streamManagement.enable) {
46455
46454
  message.id = paramsCreateMsg.id;
46456
46455
  message.jid_or_user_id = jid_or_user_id;
46457
46456
  self.connection.send(stanza, message);
@@ -46459,7 +46458,7 @@ ChatProxy.prototype = {
46459
46458
  self.connection.send(stanza);
46460
46459
  }
46461
46460
  } else {
46462
- if(config.streamManagement.enable){
46461
+ if (config.streamManagement.enable) {
46463
46462
  message.id = paramsCreateMsg.id;
46464
46463
  message.jid_or_user_id = jid_or_user_id;
46465
46464
  self.Client.send(stanza, message);
@@ -46473,13 +46472,13 @@ ChatProxy.prototype = {
46473
46472
  },
46474
46473
 
46475
46474
  /**
46476
- * Send system message (system notification) to 1 to 1 or group dialog({@link https://docs.quickblox.com/docs/js-chat-messaging#send-system-messages read more}).
46475
+ * Send system message (system notification) to 1 to 1 or group dialog. {@link https://quickblox.com/developers/Web_XMPP_Chat_Sample#System_notifications More info.}
46477
46476
  * @memberof QB.chat
46478
- * @param {String | Number} jid_or_user_id - Use opponent id for 1 to 1 chat, and room jid for group chat.
46477
+ * @param {String | Number} jid_or_user_id - Use opponent id or jid for 1 to 1 chat, and room jid for group chat.
46479
46478
  * @param {Object} message - The message object.
46480
- * @returns {String} messageId - The current message id (was generated by SDK).
46479
+ * @returns {String} messageId - The current message id (was generated by SDK)
46481
46480
  * */
46482
- sendSystemMessage: function(jid_or_user_id, message) {
46481
+ sendSystemMessage: function (jid_or_user_id, message) {
46483
46482
  Utils.QBLog('[QBChat]', 'Call sendSystemMessage ' + JSON.stringify(message));
46484
46483
  var self = this,
46485
46484
  builder = Utils.getEnv().browser ? $msg : XMPP.Stanza,
@@ -46497,7 +46496,7 @@ ChatProxy.prototype = {
46497
46496
  }).t(message.body).up();
46498
46497
  }
46499
46498
 
46500
- if(Utils.getEnv().browser) {
46499
+ if (Utils.getEnv().browser) {
46501
46500
  // custom parameters
46502
46501
  if (message.extension) {
46503
46502
  stanza.c('extraParams', {
@@ -46510,7 +46509,7 @@ ChatProxy.prototype = {
46510
46509
  self.connection.send(stanza);
46511
46510
  } else {
46512
46511
  if (message.extension) {
46513
- stanza.c('extraParams', {
46512
+ stanza.c('extraParams', {
46514
46513
  xmlns: chatUtils.MARKERS.CLIENT
46515
46514
  }).c('moduleIdentifier').t('SystemNotifications');
46516
46515
 
@@ -46524,11 +46523,11 @@ ChatProxy.prototype = {
46524
46523
  },
46525
46524
 
46526
46525
  /**
46527
- * Send is typing status({@link https://docs.quickblox.com/docs/js-chat-messaging#send-typing-indicators read more}).
46526
+ * Send is typing status. {@link https://quickblox.com/developers/Web_XMPP_Chat_Sample#Typing_status More info.}
46528
46527
  * @memberof QB.chat
46529
- * @param {String | Number} jid_or_user_id - Use opponent id for 1 to 1 chat, and room jid for group chat.
46528
+ * @param {String | Number} jid_or_user_id - Use opponent id or jid for 1 to 1 chat, and room jid for group chat.
46530
46529
  * */
46531
- sendIsTypingStatus: function(jid_or_user_id) {
46530
+ sendIsTypingStatus: function (jid_or_user_id) {
46532
46531
  Utils.QBLog('[QBChat]', 'Call sendIsTypingStatus ');
46533
46532
  var self = this,
46534
46533
  stanzaParams = {
@@ -46544,7 +46543,7 @@ ChatProxy.prototype = {
46544
46543
  xmlns: chatUtils.MARKERS.STATES
46545
46544
  });
46546
46545
 
46547
- if(Utils.getEnv().browser){
46546
+ if (Utils.getEnv().browser) {
46548
46547
  self.connection.send(stanza);
46549
46548
  } else {
46550
46549
  self.Client.send(stanza);
@@ -46552,11 +46551,11 @@ ChatProxy.prototype = {
46552
46551
  },
46553
46552
 
46554
46553
  /**
46555
- * Send is stop typing status({@link https://docs.quickblox.com/docs/js-chat-messaging#send-typing-indicators read more}).
46554
+ * Send is stop typing status. {@link https://quickblox.com/developers/Web_XMPP_Chat_Sample#Typing_status More info.}
46556
46555
  * @memberof QB.chat
46557
- * @param {String | Number} jid_or_user_id - Use opponent id for 1 to 1 chat, and room jid for group chat.
46556
+ * @param {String | Number} jid_or_user_id - Use opponent id or jid for 1 to 1 chat, and room jid for group chat.
46558
46557
  * */
46559
- sendIsStopTypingStatus: function(jid_or_user_id) {
46558
+ sendIsStopTypingStatus: function (jid_or_user_id) {
46560
46559
  Utils.QBLog('[QBChat]', 'Call sendIsStopTypingStatus ');
46561
46560
  var self = this,
46562
46561
  stanzaParams = {
@@ -46572,7 +46571,7 @@ ChatProxy.prototype = {
46572
46571
  xmlns: chatUtils.MARKERS.STATES
46573
46572
  });
46574
46573
 
46575
- if(Utils.getEnv().browser){
46574
+ if (Utils.getEnv().browser) {
46576
46575
  self.connection.send(stanza);
46577
46576
  } else {
46578
46577
  self.Client.send(stanza);
@@ -46580,14 +46579,14 @@ ChatProxy.prototype = {
46580
46579
  },
46581
46580
 
46582
46581
  /**
46583
- * Send is delivered status({@link https://docs.quickblox.com/docs/js-chat-messaging#mark-message-as-delivered read more}).
46582
+ * Send is delivered status. {@link https://quickblox.com/developers/Web_XMPP_Chat_Sample#Delivered_status More info.}
46584
46583
  * @memberof QB.chats
46585
- * @param {Object} params - Object of parameters.
46586
- * @param {Number} params.userId - The receiver id.
46587
- * @param {Number} params.messageId - The delivered message id.
46588
- * @param {Number} params.dialogId - The dialog id.
46584
+ * @param {Object} params - Object of parameters
46585
+ * @param {Number} params.userId - The receiver id
46586
+ * @param {Number} params.messageId - The delivered message id
46587
+ * @param {Number} params.dialogId - The dialog id
46589
46588
  * */
46590
- sendDeliveredStatus: function(params) {
46589
+ sendDeliveredStatus: function (params) {
46591
46590
  Utils.QBLog('[QBChat]', 'Call sendDeliveredStatus ');
46592
46591
  var self = this,
46593
46592
  stanzaParams = {
@@ -46609,7 +46608,7 @@ ChatProxy.prototype = {
46609
46608
  xmlns: chatUtils.MARKERS.CLIENT
46610
46609
  }).c('dialog_id').t(params.dialogId);
46611
46610
 
46612
- if(Utils.getEnv().browser) {
46611
+ if (Utils.getEnv().browser) {
46613
46612
  self.connection.send(stanza);
46614
46613
  } else {
46615
46614
  self.Client.send(stanza);
@@ -46617,14 +46616,14 @@ ChatProxy.prototype = {
46617
46616
  },
46618
46617
 
46619
46618
  /**
46620
- * Send is read status({@link https://docs.quickblox.com/docs/js-chat-messaging#mark-message-as-read read more}).
46619
+ * Send is read status. {@link https://quickblox.com/developers/Web_XMPP_Chat_Sample#Read_status More info.}
46621
46620
  * @memberof QB.chat
46622
- * @param {Object} params - Object of parameters.
46623
- * @param {Number} params.userId - The receiver id.
46624
- * @param {Number} params.messageId - The delivered message id.
46625
- * @param {Number} params.dialogId - The dialog id.
46621
+ * @param {Object} params - Object of parameters
46622
+ * @param {Number} params.userId - The receiver id
46623
+ * @param {Number} params.messageId - The delivered message id
46624
+ * @param {Number} params.dialogId - The dialog id
46626
46625
  * */
46627
- sendReadStatus: function(params) {
46626
+ sendReadStatus: function (params) {
46628
46627
  Utils.QBLog('[QBChat]', 'Call sendReadStatus ' + JSON.stringify(params));
46629
46628
  var self = this,
46630
46629
  stanzaParams = {
@@ -46646,7 +46645,7 @@ ChatProxy.prototype = {
46646
46645
  xmlns: chatUtils.MARKERS.CLIENT
46647
46646
  }).c('dialog_id').t(params.dialogId);
46648
46647
 
46649
- if(Utils.getEnv().browser) {
46648
+ if (Utils.getEnv().browser) {
46650
46649
  self.connection.send(stanza);
46651
46650
  } else {
46652
46651
  self.Client.send(stanza);
@@ -46654,11 +46653,11 @@ ChatProxy.prototype = {
46654
46653
  },
46655
46654
 
46656
46655
  /**
46657
- * Send query to get last user activity by QB.chat.onLastUserActivityListener(userId, seconds)({@link https://xmpp.org/extensions/xep-0012.html read more}).
46656
+ * Send query to get last user activity by QB.chat.onLastUserActivityListener(userId, seconds). {@link https://xmpp.org/extensions/xep-0012.html More info.}
46658
46657
  * @memberof QB.chat
46659
- * @param {(Number|String)} jid_or_user_id - The user id or jid, that the last activity we want to know.
46658
+ * @param {(Number|String)} jid_or_user_id - The user id or jid, that the last activity we want to know
46660
46659
  * */
46661
- getLastUserActivity: function(jid_or_user_id) {
46660
+ getLastUserActivity: function (jid_or_user_id) {
46662
46661
  Utils.QBLog('[QBChat]', 'Call getLastUserActivity ');
46663
46662
  var iqParams,
46664
46663
  builder,
@@ -46686,8 +46685,8 @@ ChatProxy.prototype = {
46686
46685
  }
46687
46686
  },
46688
46687
 
46689
- pinglocalhost: function(callback){
46690
- Utils.QBLog('[QBChat]', 'ping localhost');
46688
+ pingchat: function (callback) {
46689
+ Utils.QBLog('[QBChat]', 'ping chat');
46691
46690
  var self = this;
46692
46691
  var id = this.helpers.getUniqueId('ping');
46693
46692
  var builder = Utils.getEnv().browser ? $iq : XMPP.Stanza;
@@ -46696,7 +46695,8 @@ ChatProxy.prototype = {
46696
46695
  var stanza;
46697
46696
 
46698
46697
  //to = config.endpoints.chat;
46699
- to = 'http://localhost';
46698
+ //to = 'http://localhost';
46699
+ to = config.endpoints.chat? config.endpoints.chat : 'chat.quickblox.com';
46700
46700
  _callback = callback;
46701
46701
 
46702
46702
  var iqParams = {
@@ -46706,10 +46706,10 @@ ChatProxy.prototype = {
46706
46706
  type: 'get'
46707
46707
  };
46708
46708
  stanza = chatUtils.createStanza(builder, iqParams, 'iq');
46709
- stanza.c('ping', { xmlns: "urn:xmpp:ping" });
46709
+ stanza.c('ping', {xmlns: "urn:xmpp:ping"});
46710
46710
 
46711
46711
  var noAnswer = function () {
46712
- _callback('Local ping No answer');
46712
+ _callback('Chat ping No answer');
46713
46713
  self._pings[id] = undefined;
46714
46714
  delete self._pings[id];
46715
46715
  };
@@ -46734,7 +46734,7 @@ ChatProxy.prototype = {
46734
46734
  var _callback;
46735
46735
  var stanza;
46736
46736
  if ((typeof jid_or_user_id === 'string' ||
46737
- typeof jid_or_user_id === 'number') &&
46737
+ typeof jid_or_user_id === 'number') &&
46738
46738
  typeof callback === 'function') {
46739
46739
  to = this.helpers.jidOrUserId(jid_or_user_id);
46740
46740
  _callback = callback;
@@ -46754,7 +46754,7 @@ ChatProxy.prototype = {
46754
46754
  type: 'get'
46755
46755
  };
46756
46756
  stanza = chatUtils.createStanza(builder, iqParams, 'iq');
46757
- stanza.c('ping', { xmlns: "urn:xmpp:ping" });
46757
+ stanza.c('ping', {xmlns: "urn:xmpp:ping"});
46758
46758
 
46759
46759
  var noAnswer = function () {
46760
46760
  _callback('No answer');
@@ -46774,10 +46774,10 @@ ChatProxy.prototype = {
46774
46774
  },
46775
46775
 
46776
46776
  /**
46777
- * Disconnect from the Chat({@link https://docs.quickblox.com/docs/js-chat-connection#disconnect-from-chat-server read more}).
46777
+ * Logout from the Chat. {@link https://quickblox.com/developers/Web_XMPP_Chat_Sample#Logout_from_Chat More info.}
46778
46778
  * @memberof QB.chat
46779
46779
  * */
46780
- disconnect: function() {
46780
+ disconnect: function () {
46781
46781
  Utils.QBLog('[QBChat]', 'Call disconnect ');
46782
46782
  clearInterval(this._checkConnectionTimer);
46783
46783
  clearInterval(this._checkExpiredSessionTimer);
@@ -46800,10 +46800,10 @@ ChatProxy.prototype = {
46800
46800
  }
46801
46801
  },
46802
46802
 
46803
- addListener: function(params, callback) {
46803
+ addListener: function (params, callback) {
46804
46804
  Utils.QBLog('[Deprecated!]', 'Avoid using it, this feature will be removed in future version.');
46805
46805
 
46806
- if(!Utils.getEnv().browser) {
46806
+ if (!Utils.getEnv().browser) {
46807
46807
  throw new Error(unsupportedError);
46808
46808
  }
46809
46809
 
@@ -46816,10 +46816,10 @@ ChatProxy.prototype = {
46816
46816
  }
46817
46817
  },
46818
46818
 
46819
- deleteListener: function(ref) {
46819
+ deleteListener: function (ref) {
46820
46820
  Utils.QBLog('[Deprecated!]', 'Avoid using it, this feature will be removed in future version.');
46821
46821
 
46822
- if(!Utils.getEnv().browser) {
46822
+ if (!Utils.getEnv().browser) {
46823
46823
  throw new Error(unsupportedError);
46824
46824
  }
46825
46825
 
@@ -46829,7 +46829,7 @@ ChatProxy.prototype = {
46829
46829
  /**
46830
46830
  * Carbons XEP [http://xmpp.org/extensions/xep-0280.html]
46831
46831
  */
46832
- _enableCarbons: function(cb) {
46832
+ _enableCarbons: function (cb) {
46833
46833
  var self = this,
46834
46834
  carbonParams = {
46835
46835
  type: 'set',
@@ -46875,11 +46875,11 @@ function RosterProxy(options) {
46875
46875
  RosterProxy.prototype = {
46876
46876
 
46877
46877
  /**
46878
- * Receive contact list({@link https://docs.quickblox.com/docs/js-chat-contact-list#access-contact-list read more}).
46878
+ * Receive contact list. {@link https://quickblox.com/developers/Web_XMPP_Chat_Sample#Contact_List More info.}
46879
46879
  * @memberof QB.chat.roster
46880
46880
  * @param {getRosterCallback} callback - The callback function.
46881
46881
  * */
46882
- get: function(callback) {
46882
+ get: function (callback) {
46883
46883
  /**
46884
46884
  * This callback Return contact list.
46885
46885
  * @callback getRosterCallback
@@ -46898,7 +46898,7 @@ RosterProxy.prototype = {
46898
46898
  var iq = chatUtils.createStanza(builder, iqParams, 'iq');
46899
46899
 
46900
46900
  function _getItems(stanza) {
46901
- if(Utils.getEnv().browser) {
46901
+ if (Utils.getEnv().browser) {
46902
46902
  return stanza.getElementsByTagName('item');
46903
46903
  } else {
46904
46904
  return stanza.getChild('query').children;
@@ -46908,7 +46908,7 @@ RosterProxy.prototype = {
46908
46908
  function _callbackWrap(stanza) {
46909
46909
  var items = _getItems(stanza);
46910
46910
  for (var i = 0, len = items.length; i < len; i++) {
46911
- var userId = self.helpers.getIdFromNode( chatUtils.getAttr(items[i], 'jid') ),
46911
+ var userId = self.helpers.getIdFromNode(chatUtils.getAttr(items[i], 'jid')),
46912
46912
  ask = chatUtils.getAttr(items[i], 'ask'),
46913
46913
  subscription = chatUtils.getAttr(items[i], 'subscription');
46914
46914
 
@@ -46925,7 +46925,7 @@ RosterProxy.prototype = {
46925
46925
  xmlns: chatUtils.MARKERS.ROSTER
46926
46926
  });
46927
46927
 
46928
- if(Utils.getEnv().browser) {
46928
+ if (Utils.getEnv().browser) {
46929
46929
  self.connection.sendIQ(iq, _callbackWrap);
46930
46930
  } else {
46931
46931
  self.nodeStanzasCallbacks[iqParams.id] = _callbackWrap;
@@ -46934,12 +46934,12 @@ RosterProxy.prototype = {
46934
46934
  },
46935
46935
 
46936
46936
  /**
46937
- * Add users to contact list({@link https://docs.quickblox.com/docs/js-chat-contact-list#add-user-to-your-contact-list read more}).
46937
+ * Add users to contact list. {@link https://quickblox.com/developers/Web_XMPP_Chat_Sample#Add_users More info.}
46938
46938
  * @memberof QB.chat.roster
46939
46939
  * @param {String | Number} jidOrUserId - Use opponent id for 1 to 1 chat, and jid for group chat.
46940
46940
  * @param {addRosterCallback} callback - The callback function.
46941
46941
  * */
46942
- add: function(jidOrUserId, callback) {
46942
+ add: function (jidOrUserId, callback) {
46943
46943
 
46944
46944
  /**
46945
46945
  * Callback for QB.chat.roster.add(). Run without parameters.
@@ -46965,12 +46965,12 @@ RosterProxy.prototype = {
46965
46965
  },
46966
46966
 
46967
46967
  /**
46968
- * Confirm subscription with some user({@link https://docs.quickblox.com/docs/js-chat-contact-list#confirm-the-contact-request read more}).
46968
+ * Confirm subscription with some user. {@link https://quickblox.com/developers/Web_XMPP_Chat_Sample#Confirm_subscription_request More info.}
46969
46969
  * @memberof QB.chat.roster
46970
46970
  * @param {String | Number} jidOrUserId - Use opponent id for 1 to 1 chat, and jid for group chat.
46971
46971
  * @param {confirmRosterCallback} callback - The callback function.
46972
46972
  * */
46973
- confirm: function(jidOrUserId, callback) {
46973
+ confirm: function (jidOrUserId, callback) {
46974
46974
 
46975
46975
  /**
46976
46976
  * Callback for QB.chat.roster.confirm(). Run without parameters.
@@ -47002,12 +47002,12 @@ RosterProxy.prototype = {
47002
47002
  },
47003
47003
 
47004
47004
  /**
47005
- * Reject subscription with some user({@link https://docs.quickblox.com/docs/js-chat-contact-list#reject-the-contact-request read more}).
47005
+ * Reject subscription with some user. {@link https://quickblox.com/developers/Web_XMPP_Chat_Sample#Reject_subscription_request More info.}
47006
47006
  * @memberof QB.chat.roster
47007
47007
  * @param {String | Number} jidOrUserId - Use opponent id for 1 to 1 chat, and jid for group chat.
47008
47008
  * @param {rejectRosterCallback} callback - The callback function.
47009
47009
  * */
47010
- reject: function(jidOrUserId, callback) {
47010
+ reject: function (jidOrUserId, callback) {
47011
47011
 
47012
47012
  /**
47013
47013
  * Callback for QB.chat.roster.reject(). Run without parameters.
@@ -47034,12 +47034,12 @@ RosterProxy.prototype = {
47034
47034
 
47035
47035
 
47036
47036
  /**
47037
- * Remove subscription with some user from your contact list({@link https://docs.quickblox.com/docs/js-chat-contact-list#remove-user-from-the-contact-list read more}).
47037
+ * Remove subscription with some user from your contact list. {@link https://quickblox.com/developers/Web_XMPP_Chat_Sample#Remove_users More info.}
47038
47038
  * @memberof QB.chat.roster
47039
47039
  * @param {String | Number} jidOrUserId - Use opponent id for 1 to 1 chat, and jid for group chat.
47040
47040
  * @param {removeRosterCallback} callback - The callback function.
47041
47041
  * */
47042
- remove: function(jidOrUserId, callback) {
47042
+ remove: function (jidOrUserId, callback) {
47043
47043
 
47044
47044
  /**
47045
47045
  * Callback for QB.chat.roster.remove(). Run without parameters.
@@ -47073,7 +47073,7 @@ RosterProxy.prototype = {
47073
47073
  subscription: 'remove'
47074
47074
  });
47075
47075
 
47076
- if(Utils.getEnv().browser) {
47076
+ if (Utils.getEnv().browser) {
47077
47077
  self.connection.sendIQ(iq, _callbackWrap);
47078
47078
  } else {
47079
47079
  self.nodeStanzasCallbacks[iqParams.id] = _callbackWrap;
@@ -47081,7 +47081,7 @@ RosterProxy.prototype = {
47081
47081
  }
47082
47082
  },
47083
47083
 
47084
- _sendSubscriptionPresence: function(params) {
47084
+ _sendSubscriptionPresence: function (params) {
47085
47085
  var builder = Utils.getEnv().browser ? $pres : XMPP.Stanza,
47086
47086
  presParams = {
47087
47087
  to: params.jid,
@@ -47090,7 +47090,7 @@ RosterProxy.prototype = {
47090
47090
 
47091
47091
  var pres = chatUtils.createStanza(builder, presParams, 'presence');
47092
47092
 
47093
- if (Utils.getEnv().browser){
47093
+ if (Utils.getEnv().browser) {
47094
47094
  this.connection.send(pres);
47095
47095
  } else {
47096
47096
  this.Client.send(pres);
@@ -47121,16 +47121,16 @@ function MucProxy(options) {
47121
47121
  MucProxy.prototype = {
47122
47122
 
47123
47123
  /**
47124
- * Join to the group dialog({@link https://docs.quickblox.com/docs/js-chat-dialogs#join-dialog read more}).
47124
+ * Join to the group dialog. {@link https://quickblox.com/developers/Web_XMPP_Chat_Sample#Chat_in_group_dialog More info.}
47125
47125
  * @memberof QB.chat.muc
47126
47126
  * @param {String} dialogIdOrJid - Use dialog jid or dialog id to join to this dialog.
47127
47127
  * @param {joinMacCallback} callback - The callback function.
47128
47128
  * */
47129
- join: function(dialogIdOrJid, callback) {
47129
+ join: function (dialogIdOrJid, callback) {
47130
47130
  /**
47131
47131
  * Callback for QB.chat.muc.join().
47132
- * @param {Object} error - Returns error object or null.
47133
- * @param {Object} responce - Returns responce.
47132
+ * @param {Object} error - Returns error object or null
47133
+ * @param {Object} responce - Returns responce
47134
47134
  * @callback joinMacCallback
47135
47135
  * */
47136
47136
  var self = this,
@@ -47149,7 +47149,7 @@ MucProxy.prototype = {
47149
47149
 
47150
47150
  pres.c('x', {
47151
47151
  xmlns: chatUtils.MARKERS.MUC
47152
- }).c('history', { maxstanzas: 0 });
47152
+ }).c('history', {maxstanzas: 0});
47153
47153
 
47154
47154
  this.joinedRooms[dialogJid] = true;
47155
47155
 
@@ -47157,7 +47157,7 @@ MucProxy.prototype = {
47157
47157
  var id = chatUtils.getAttr(stanza, 'id');
47158
47158
  var from = chatUtils.getAttr(stanza, 'from');
47159
47159
  var dialogId = self.helpers.getDialogIdFromNode(from);
47160
-
47160
+
47161
47161
  var x = chatUtils.getElement(stanza, 'x');
47162
47162
  var xXMLNS = chatUtils.getAttr(x, 'xmlns');
47163
47163
  var status = chatUtils.getElement(x, 'status');
@@ -47168,18 +47168,18 @@ MucProxy.prototype = {
47168
47168
  return true;
47169
47169
  }
47170
47170
 
47171
- if(status && statusCode == '110') {
47171
+ if (status && statusCode == '110') {
47172
47172
  Utils.safeCallbackCall(callback, null, {
47173
47173
  dialogId: dialogId
47174
47174
  });
47175
47175
  } else {
47176
47176
  var type = chatUtils.getAttr(stanza, 'type');
47177
47177
 
47178
- if(type && type === 'error' && xXMLNS == 'http://jabber.org/protocol/muc' && id.endsWith(':join')) {
47178
+ if (type && type === 'error' && xXMLNS == 'http://jabber.org/protocol/muc' && id.endsWith(':join')) {
47179
47179
  var errorEl = chatUtils.getElement(stanza, 'error');
47180
47180
  var code = chatUtils.getAttr(errorEl, 'code');
47181
47181
  var errorMessage = chatUtils.getElementText(errorEl, 'text');
47182
-
47182
+
47183
47183
  Utils.safeCallbackCall(callback, {
47184
47184
  code: code || 500,
47185
47185
  message: errorMessage || 'Unknown issue'
@@ -47206,12 +47206,12 @@ MucProxy.prototype = {
47206
47206
  },
47207
47207
 
47208
47208
  /**
47209
- * Leave group chat dialog({@link https://docs.quickblox.com/docs/js-chat-dialogs#leave-dialog read more}).
47209
+ * Leave group chat dialog. {@link https://quickblox.com/developers/Web_XMPP_Chat_Sample#Chat_in_group_dialog More info.}
47210
47210
  * @memberof QB.chat.muc
47211
- * @param {String} dialogJid - Use dialog jid to leave to this dialog.
47211
+ * @param {String} dialogJid - Use dialog jid to join to this dialog.
47212
47212
  * @param {leaveMacCallback} callback - The callback function.
47213
47213
  * */
47214
- leave: function(jid, callback) {
47214
+ leave: function (jid, callback) {
47215
47215
  /**
47216
47216
  * Callback for QB.chat.muc.leave().
47217
47217
  * run without parameters;
@@ -47240,7 +47240,7 @@ MucProxy.prototype = {
47240
47240
  self.connection.send(pres);
47241
47241
  } else {
47242
47242
  /** The answer don't contain id */
47243
- if(typeof callback === 'function') {
47243
+ if (typeof callback === 'function') {
47244
47244
  self.nodeStanzasCallbacks['muc:leave'] = callback;
47245
47245
  }
47246
47246
 
@@ -47249,15 +47249,15 @@ MucProxy.prototype = {
47249
47249
  },
47250
47250
 
47251
47251
  /**
47252
- * Leave group chat dialog({@link https://docs.quickblox.com/docs/js-chat-dialogs#retrieve-online-users read more}).
47252
+ * Leave group chat dialog. {@link https://quickblox.com/developers/Web_XMPP_Chat_Sample#Chat_in_group_dialog More info.}
47253
47253
  * @memberof QB.chat.muc
47254
- * @param {String} dialogJid - Use dialog jid to get a list of online usersr in this dialog.
47254
+ * @param {String} dialogJid - Use dialog jid to join to this dialog.
47255
47255
  * @param {listOnlineUsersMacCallback} callback - The callback function.
47256
47256
  * */
47257
- listOnlineUsers: function(dialogJID, callback) {
47257
+ listOnlineUsers: function (dialogJID, callback) {
47258
47258
  /**
47259
47259
  * Callback for QB.chat.muc.leave().
47260
- * @param {Object} Users - List of online users.
47260
+ * @param {Object} Users - list of online users
47261
47261
  * @callback listOnlineUsersMacCallback
47262
47262
  * */
47263
47263
 
@@ -47279,12 +47279,12 @@ MucProxy.prototype = {
47279
47279
  function _getUsers(stanza) {
47280
47280
  var stanzaId = stanza.attrs.id;
47281
47281
 
47282
- if(self.nodeStanzasCallbacks[stanzaId]) {
47282
+ if (self.nodeStanzasCallbacks[stanzaId]) {
47283
47283
  var users = [],
47284
47284
  items = stanza.getChild('query').getChildElements('item'),
47285
47285
  userId;
47286
47286
 
47287
- for(var i = 0, len = items.length; i < len; i++) {
47287
+ for (var i = 0, len = items.length; i < len; i++) {
47288
47288
  userId = self.helpers.getUserIdFromRoomJid(items[i].attrs.jid);
47289
47289
  users.push(parseInt(userId));
47290
47290
  }
@@ -47294,7 +47294,7 @@ MucProxy.prototype = {
47294
47294
  }
47295
47295
 
47296
47296
  if (Utils.getEnv().browser) {
47297
- self.connection.sendIQ(iq, function(stanza) {
47297
+ self.connection.sendIQ(iq, function (stanza) {
47298
47298
  var items = stanza.getElementsByTagName('item'),
47299
47299
  userId;
47300
47300
 
@@ -47332,15 +47332,15 @@ function PrivacyListProxy(options) {
47332
47332
  **/
47333
47333
  PrivacyListProxy.prototype = {
47334
47334
  /**
47335
- * Create a privacy list({@link https://docs.quickblox.com/docs/js-chat-privacy-list#create-privacy-list read more}).
47335
+ * Create a privacy list. {@link https://quickblox.com/developers/Web_XMPP_Chat_Sample#Create_a_privacy_list_or_edit_existing_list More info.}
47336
47336
  * @memberof QB.chat.privacylist
47337
- * @param {Object} list - Privacy list object.
47337
+ * @param {Object} list - privacy list object.
47338
47338
  * @param {createPrivacylistCallback} callback - The callback function.
47339
47339
  * */
47340
- create: function(list, callback) {
47340
+ create: function (list, callback) {
47341
47341
  /**
47342
47342
  * Callback for QB.chat.privacylist.create().
47343
- * @param {Object} error - The error object.
47343
+ * @param {Object} error - The error object
47344
47344
  * @callback createPrivacylistCallback
47345
47345
  * */
47346
47346
  var self = this,
@@ -47378,8 +47378,8 @@ PrivacyListProxy.prototype = {
47378
47378
  name: list.name
47379
47379
  });
47380
47380
 
47381
- function createPrivacyItem(iq, params){
47382
- if(Utils.getEnv().browser) {
47381
+ function createPrivacyItem(iq, params) {
47382
+ if (Utils.getEnv().browser) {
47383
47383
  iq.c('item', {
47384
47384
  type: 'jid',
47385
47385
  value: params.jidOrMuc,
@@ -47409,7 +47409,7 @@ PrivacyListProxy.prototype = {
47409
47409
  }
47410
47410
 
47411
47411
  function createPrivacyItemMutal(iq, params) {
47412
- if(Utils.getEnv().browser) {
47412
+ if (Utils.getEnv().browser) {
47413
47413
  iq.c('item', {
47414
47414
  type: 'jid',
47415
47415
  value: params.jidOrMuc,
@@ -47438,39 +47438,39 @@ PrivacyListProxy.prototype = {
47438
47438
  userJid = self.helpers.jidOrUserId(parseInt(userId, 10));
47439
47439
  userMuc = self.helpers.getUserNickWithMucDomain(userId);
47440
47440
 
47441
- if(mutualBlock && userAction === 'deny'){
47441
+ if (mutualBlock && userAction === 'deny') {
47442
47442
  iq = createPrivacyItemMutal(iq, {
47443
- order: j+1,
47443
+ order: j + 1,
47444
47444
  jidOrMuc: userJid,
47445
47445
  userAction: userAction
47446
47446
  });
47447
47447
  iq = createPrivacyItemMutal(iq, {
47448
- order: j+2,
47448
+ order: j + 2,
47449
47449
  jidOrMuc: userMuc,
47450
47450
  userAction: userAction
47451
47451
  }).up().up();
47452
47452
  } else {
47453
47453
  iq = createPrivacyItem(iq, {
47454
- order: j+1,
47454
+ order: j + 1,
47455
47455
  jidOrMuc: userJid,
47456
47456
  userAction: userAction
47457
47457
  });
47458
47458
  iq = createPrivacyItem(iq, {
47459
- order: j+2,
47459
+ order: j + 2,
47460
47460
  jidOrMuc: userMuc,
47461
47461
  userAction: userAction
47462
47462
  });
47463
47463
  }
47464
47464
  }
47465
47465
 
47466
- if(Utils.getEnv().browser) {
47467
- self.connection.sendIQ(iq, function(stanzaResult) {
47466
+ if (Utils.getEnv().browser) {
47467
+ self.connection.sendIQ(iq, function (stanzaResult) {
47468
47468
  callback(null);
47469
- }, function(stanzaError){
47470
- if(stanzaError){
47469
+ }, function (stanzaError) {
47470
+ if (stanzaError) {
47471
47471
  var errorObject = chatUtils.getErrorFromXMLNode(stanzaError);
47472
47472
  callback(errorObject);
47473
- }else{
47473
+ } else {
47474
47474
  callback(Utils.getError(408));
47475
47475
  }
47476
47476
  });
@@ -47478,7 +47478,7 @@ PrivacyListProxy.prototype = {
47478
47478
  self.Client.send(iq);
47479
47479
 
47480
47480
  self.nodeStanzasCallbacks[iqParams.id] = function (stanza) {
47481
- if(!stanza.getChildElements('error').length){
47481
+ if (!stanza.getChildElements('error').length) {
47482
47482
  callback(null);
47483
47483
  } else {
47484
47484
  callback(Utils.getError(408));
@@ -47488,16 +47488,16 @@ PrivacyListProxy.prototype = {
47488
47488
  },
47489
47489
 
47490
47490
  /**
47491
- * Get the privacy list({@link https://docs.quickblox.com/docs/js-chat-privacy-list#retrieve-privacy-list-by-name read more}).
47491
+ * Get the privacy list. {@link https://quickblox.com/developers/Web_XMPP_Chat_Sample#Retrieve_a_privacy_list More info.}
47492
47492
  * @memberof QB.chat.privacylist
47493
47493
  * @param {String} name - The name of the list.
47494
47494
  * @param {getListPrivacylistCallback} callback - The callback function.
47495
47495
  * */
47496
- getList: function(name, callback) {
47496
+ getList: function (name, callback) {
47497
47497
  /**
47498
47498
  * Callback for QB.chat.privacylist.getList().
47499
- * @param {Object} error - The error object.
47500
- * @param {Object} response - The privacy list object.
47499
+ * @param {Object} error - The error object
47500
+ * @param {Object} response - The privacy list object
47501
47501
  * @callback getListPrivacylistCallback
47502
47502
  * */
47503
47503
 
@@ -47520,11 +47520,11 @@ PrivacyListProxy.prototype = {
47520
47520
  name: name
47521
47521
  });
47522
47522
 
47523
- if(Utils.getEnv().browser) {
47524
- self.connection.sendIQ(iq, function(stanzaResult) {
47523
+ if (Utils.getEnv().browser) {
47524
+ self.connection.sendIQ(iq, function (stanzaResult) {
47525
47525
  items = stanzaResult.getElementsByTagName('item');
47526
47526
 
47527
- for (var i = 0, len = items.length; i < len; i=i+2) {
47527
+ for (var i = 0, len = items.length; i < len; i = i + 2) {
47528
47528
  userJid = items[i].getAttribute('value');
47529
47529
  userId = self.helpers.getIdFromNode(userJid);
47530
47530
  usersList.push({
@@ -47537,22 +47537,22 @@ PrivacyListProxy.prototype = {
47537
47537
  items: usersList
47538
47538
  };
47539
47539
  callback(null, list);
47540
- }, function(stanzaError){
47541
- if(stanzaError){
47540
+ }, function (stanzaError) {
47541
+ if (stanzaError) {
47542
47542
  var errorObject = chatUtils.getErrorFromXMLNode(stanzaError);
47543
47543
  callback(errorObject, null);
47544
- }else{
47544
+ } else {
47545
47545
  callback(Utils.getError(408), null);
47546
47546
  }
47547
47547
  });
47548
47548
  } else {
47549
- self.nodeStanzasCallbacks[iqParams.id] = function(stanza){
47549
+ self.nodeStanzasCallbacks[iqParams.id] = function (stanza) {
47550
47550
  var stanzaQuery = stanza.getChild('query'),
47551
47551
  list = stanzaQuery ? stanzaQuery.getChild('list') : null,
47552
47552
  items = list ? list.getChildElements('item') : null,
47553
47553
  userJid, userId, usersList = [];
47554
47554
 
47555
- for (var i = 0, len = items.length; i < len; i=i+2) {
47555
+ for (var i = 0, len = items.length; i < len; i = i + 2) {
47556
47556
  userJid = items[i].attrs.value;
47557
47557
  userId = self.helpers.getIdFromNode(userJid);
47558
47558
  usersList.push({
@@ -47575,22 +47575,22 @@ PrivacyListProxy.prototype = {
47575
47575
  },
47576
47576
 
47577
47577
  /**
47578
- * Update the privacy list({@link https://docs.quickblox.com/docs/js-chat-privacy-list#update-privacy-list read more}).
47578
+ * Update the privacy list.
47579
47579
  * @memberof QB.chat.privacylist
47580
47580
  * @param {String} name - The name of the list.
47581
47581
  * @param {updatePrivacylistCallback} callback - The callback function.
47582
47582
  * */
47583
- update: function(listWithUpdates, callback) {
47583
+ update: function (listWithUpdates, callback) {
47584
47584
  /**
47585
47585
  * Callback for QB.chat.privacylist.update().
47586
- * @param {Object} error - The error object.
47587
- * @param {Object} response - The privacy list object.
47586
+ * @param {Object} error - The error object
47587
+ * @param {Object} response - The privacy list object
47588
47588
  * @callback updatePrivacylistCallback
47589
47589
  * */
47590
47590
 
47591
47591
  var self = this;
47592
47592
 
47593
- self.getList(listWithUpdates.name, function(error, existentList) {
47593
+ self.getList(listWithUpdates.name, function (error, existentList) {
47594
47594
  if (error) {
47595
47595
  callback(error, null);
47596
47596
  } else {
@@ -47598,10 +47598,10 @@ PrivacyListProxy.prototype = {
47598
47598
  updatedList.items = Utils.MergeArrayOfObjects(existentList.items, listWithUpdates.items);
47599
47599
  updatedList.name = listWithUpdates.name;
47600
47600
 
47601
- self.create(updatedList, function(err, result) {
47601
+ self.create(updatedList, function (err, result) {
47602
47602
  if (error) {
47603
47603
  callback(err, null);
47604
- }else{
47604
+ } else {
47605
47605
  callback(null, result);
47606
47606
  }
47607
47607
  });
@@ -47610,16 +47610,16 @@ PrivacyListProxy.prototype = {
47610
47610
  },
47611
47611
 
47612
47612
  /**
47613
- * Get names of privacy lists({@link https://docs.quickblox.com/docs/js-chat-privacy-list#retrieve-privacy-lists read more}).
47613
+ * Get names of privacy lists. {@link https://quickblox.com/developers/Web_XMPP_Chat_Sample#Retrieve_privacy_lists_names More info.}
47614
47614
  * Run without parameters
47615
47615
  * @memberof QB.chat.privacylist
47616
47616
  * @param {getNamesPrivacylistCallback} callback - The callback function.
47617
47617
  * */
47618
- getNames: function(callback) {
47618
+ getNames: function (callback) {
47619
47619
  /**
47620
47620
  * Callback for QB.chat.privacylist.getNames().
47621
- * @param {Object} error - The error object.
47622
- * @param {Object} response - The privacy list object (var names = response.names;).
47621
+ * @param {Object} error - The error object
47622
+ * @param {Object} response - The privacy list object (var names = response.names;)
47623
47623
  * @callback getNamesPrivacylistCallback
47624
47624
  * */
47625
47625
 
@@ -47631,12 +47631,12 @@ PrivacyListProxy.prototype = {
47631
47631
  'id': chatUtils.getUniqueId('getNames')
47632
47632
  };
47633
47633
 
47634
- if(Utils.getEnv().browser){
47634
+ if (Utils.getEnv().browser) {
47635
47635
  iq = $iq(stanzaParams).c('query', {
47636
47636
  xmlns: Strophe.NS.PRIVACY_LIST
47637
47637
  });
47638
47638
 
47639
- self.connection.sendIQ(iq, function(stanzaResult) {
47639
+ self.connection.sendIQ(iq, function (stanzaResult) {
47640
47640
  var allNames = [], namesList = {},
47641
47641
  defaultList = stanzaResult.getElementsByTagName('default'),
47642
47642
  activeList = stanzaResult.getElementsByTagName('active'),
@@ -47656,11 +47656,11 @@ PrivacyListProxy.prototype = {
47656
47656
  };
47657
47657
 
47658
47658
  callback(null, namesList);
47659
- }, function(stanzaError){
47660
- if(stanzaError){
47659
+ }, function (stanzaError) {
47660
+ if (stanzaError) {
47661
47661
  var errorObject = chatUtils.getErrorFromXMLNode(stanzaError);
47662
47662
  callback(errorObject, null);
47663
- }else{
47663
+ } else {
47664
47664
  callback(Utils.getError(408), null);
47665
47665
  }
47666
47666
  });
@@ -47671,8 +47671,8 @@ PrivacyListProxy.prototype = {
47671
47671
  xmlns: chatUtils.MARKERS.PRIVACY
47672
47672
  });
47673
47673
 
47674
- self.nodeStanzasCallbacks[iq.attrs.id] = function(stanza){
47675
- if(stanza.attrs.type !== 'error'){
47674
+ self.nodeStanzasCallbacks[iq.attrs.id] = function (stanza) {
47675
+ if (stanza.attrs.type !== 'error') {
47676
47676
 
47677
47677
  var allNames = [], namesList = {},
47678
47678
  query = stanza.getChild('query'),
@@ -47704,15 +47704,15 @@ PrivacyListProxy.prototype = {
47704
47704
  },
47705
47705
 
47706
47706
  /**
47707
- * Delete privacy list({@link https://docs.quickblox.com/docs/js-chat-privacy-list#remove-privacy-list read more}).
47707
+ * Delete privacy list. {@link https://quickblox.com/developers/Web_XMPP_Chat_Sample#Delete_existing_privacy_list More info.}
47708
47708
  * @param {String} name - The name of privacy list.
47709
47709
  * @memberof QB.chat.privacylist
47710
47710
  * @param {deletePrivacylistCallback} callback - The callback function.
47711
47711
  * */
47712
- delete: function(name, callback) {
47712
+ delete: function (name, callback) {
47713
47713
  /**
47714
47714
  * Callback for QB.chat.privacylist.delete().
47715
- * @param {Object} error - The error object.
47715
+ * @param {Object} error - The error object
47716
47716
  * @callback deletePrivacylistCallback
47717
47717
  * */
47718
47718
 
@@ -47723,20 +47723,20 @@ PrivacyListProxy.prototype = {
47723
47723
  'id': chatUtils.getUniqueId('remove')
47724
47724
  };
47725
47725
 
47726
- if(Utils.getEnv().browser){
47726
+ if (Utils.getEnv().browser) {
47727
47727
  iq = $iq(stanzaParams).c('query', {
47728
47728
  xmlns: Strophe.NS.PRIVACY_LIST
47729
47729
  }).c('list', {
47730
47730
  name: name ? name : ''
47731
47731
  });
47732
47732
 
47733
- this.connection.sendIQ(iq, function(stanzaResult) {
47733
+ this.connection.sendIQ(iq, function (stanzaResult) {
47734
47734
  callback(null);
47735
- }, function(stanzaError){
47736
- if(stanzaError){
47735
+ }, function (stanzaError) {
47736
+ if (stanzaError) {
47737
47737
  var errorObject = chatUtils.getErrorFromXMLNode(stanzaError);
47738
47738
  callback(errorObject);
47739
- }else{
47739
+ } else {
47740
47740
  callback(Utils.getError(408));
47741
47741
  }
47742
47742
  });
@@ -47750,8 +47750,8 @@ PrivacyListProxy.prototype = {
47750
47750
  name: name ? name : ''
47751
47751
  });
47752
47752
 
47753
- this.nodeStanzasCallbacks[stanzaParams.id] = function(stanza){
47754
- if(!stanza.getChildElements('error').length){
47753
+ this.nodeStanzasCallbacks[stanzaParams.id] = function (stanza) {
47754
+ if (!stanza.getChildElements('error').length) {
47755
47755
  callback(null);
47756
47756
  } else {
47757
47757
  callback(Utils.getError(408));
@@ -47764,15 +47764,15 @@ PrivacyListProxy.prototype = {
47764
47764
  },
47765
47765
 
47766
47766
  /**
47767
- * Set as default privacy list({@link https://docs.quickblox.com/docs/js-chat-privacy-list#activate-privacy-list read more}).
47767
+ * Set as default privacy list. {@link https://quickblox.com/developers/Web_XMPP_Chat_Sample#Activate_a_privacy_list More info.}
47768
47768
  * @param {String} name - The name of privacy list.
47769
47769
  * @memberof QB.chat.privacylist
47770
47770
  * @param {setAsDefaultPrivacylistCallback} callback - The callback function.
47771
47771
  * */
47772
- setAsDefault: function(name, callback) {
47772
+ setAsDefault: function (name, callback) {
47773
47773
  /**
47774
47774
  * Callback for QB.chat.privacylist.setAsDefault().
47775
- * @param {Object} error - The error object.
47775
+ * @param {Object} error - The error object
47776
47776
  * @callback setAsDefaultPrivacylistCallback
47777
47777
  * */
47778
47778
 
@@ -47784,18 +47784,18 @@ PrivacyListProxy.prototype = {
47784
47784
  'id': chatUtils.getUniqueId('default')
47785
47785
  };
47786
47786
 
47787
- if(Utils.getEnv().browser){
47787
+ if (Utils.getEnv().browser) {
47788
47788
  iq = $iq(stanzaParams).c('query', {
47789
47789
  xmlns: Strophe.NS.PRIVACY_LIST
47790
47790
  }).c('default', name && name.length > 0 ? {name: name} : {});
47791
47791
 
47792
- this.connection.sendIQ(iq, function(stanzaResult) {
47792
+ this.connection.sendIQ(iq, function (stanzaResult) {
47793
47793
  setAsActive(self); //Activate list after setting it as default.
47794
- }, function(stanzaError){
47795
- if(stanzaError){
47794
+ }, function (stanzaError) {
47795
+ if (stanzaError) {
47796
47796
  var errorObject = chatUtils.getErrorFromXMLNode(stanzaError);
47797
47797
  callback(errorObject);
47798
- }else{
47798
+ } else {
47799
47799
  callback(Utils.getError(408));
47800
47800
  }
47801
47801
  });
@@ -47806,8 +47806,8 @@ PrivacyListProxy.prototype = {
47806
47806
  xmlns: chatUtils.MARKERS.PRIVACY
47807
47807
  }).c('default', name && name.length > 0 ? {name: name} : {});
47808
47808
 
47809
- this.nodeStanzasCallbacks[stanzaParams.id] = function(stanza){
47810
- if(!stanza.getChildElements('error').length){
47809
+ this.nodeStanzasCallbacks[stanzaParams.id] = function (stanza) {
47810
+ if (!stanza.getChildElements('error').length) {
47811
47811
  setAsActive(self); //Activate list after setting it as default.
47812
47812
  } else {
47813
47813
  callback(Utils.getError(408));
@@ -47817,27 +47817,27 @@ PrivacyListProxy.prototype = {
47817
47817
  }
47818
47818
 
47819
47819
  /**
47820
- * Set as active privacy list after setting as default.
47821
- * @param {PrivacyListProxy} self - Privacy list.
47822
- * */
47820
+ * Set as active privacy list after setting as default.
47821
+ * @param {PrivacyListProxy Object} self - The name of privacy list.
47822
+ * */
47823
47823
  function setAsActive(self) {
47824
47824
  var setAsActiveIq,
47825
- setAsActiveStanzaParams = {
47826
- 'from': self.connection ? self.connection.jid : self.Client.jid.user,
47827
- 'type': 'set',
47828
- 'id': chatUtils.getUniqueId('active1')
47829
- };
47830
- if(Utils.getEnv().browser){
47825
+ setAsActiveStanzaParams = {
47826
+ 'from': self.connection ? self.connection.jid : self.Client.jid.user,
47827
+ 'type': 'set',
47828
+ 'id': chatUtils.getUniqueId('active1')
47829
+ };
47830
+ if (Utils.getEnv().browser) {
47831
47831
  setAsActiveIq = $iq(setAsActiveStanzaParams).c('query', {
47832
47832
  xmlns: Strophe.NS.PRIVACY_LIST
47833
47833
  }).c('active', name && name.length > 0 ? {name: name} : {});
47834
- self.connection.sendIQ(setAsActiveIq, function(setAsActiveStanzaResult) {
47834
+ self.connection.sendIQ(setAsActiveIq, function (setAsActiveStanzaResult) {
47835
47835
  callback(null);
47836
- }, function(setAsActiveStanzaError){
47837
- if(setAsActiveStanzaError){
47836
+ }, function (setAsActiveStanzaError) {
47837
+ if (setAsActiveStanzaError) {
47838
47838
  var setAsActiveErrorObject = chatUtils.getErrorFromXMLNode(setAsActiveStanzaError);
47839
47839
  callback(setAsActiveErrorObject);
47840
- }else{
47840
+ } else {
47841
47841
  callback(Utils.getError(408));
47842
47842
  }
47843
47843
  });
@@ -47846,8 +47846,8 @@ PrivacyListProxy.prototype = {
47846
47846
  setAsActiveIq.c('query', {
47847
47847
  xmlns: chatUtils.MARKERS.PRIVACY
47848
47848
  }).c('active', name && name.length > 0 ? {name: name} : {});
47849
- self.nodeStanzasCallbacks[setAsActiveStanzaParams.id] = function(setAsActistanza){
47850
- if(!setAsActistanza.getChildElements('error').length){
47849
+ self.nodeStanzasCallbacks[setAsActiveStanzaParams.id] = function (setAsActistanza) {
47850
+ if (!setAsActistanza.getChildElements('error').length) {
47851
47851
  callback(null);
47852
47852
  } else {
47853
47853
  callback(Utils.getError(408));
@@ -47865,6 +47865,7 @@ PrivacyListProxy.prototype = {
47865
47865
  function Helpers() {
47866
47866
  this._userCurrentJid = '';
47867
47867
  }
47868
+
47868
47869
  /**
47869
47870
  * @namespace QB.chat.helpers
47870
47871
  * */
@@ -47873,7 +47874,7 @@ Helpers.prototype = {
47873
47874
  /**
47874
47875
  * Get unique id.
47875
47876
  * @memberof QB.chat.helpers
47876
- * @param {String | Number} suffix - Not required parameter.
47877
+ * @param {String | Number} suffix - not required parameter.
47877
47878
  * @returns {String} - UniqueId.
47878
47879
  * */
47879
47880
  getUniqueId: chatUtils.getUniqueId,
@@ -47884,7 +47885,7 @@ Helpers.prototype = {
47884
47885
  * @param {String | Number} jid_or_user_id - Jid or user id.
47885
47886
  * @returns {String} - jid.
47886
47887
  * */
47887
- jidOrUserId: function(jid_or_user_id) {
47888
+ jidOrUserId: function (jid_or_user_id) {
47888
47889
  var jid;
47889
47890
  if (typeof jid_or_user_id === 'string') {
47890
47891
  jid = jid_or_user_id;
@@ -47902,7 +47903,7 @@ Helpers.prototype = {
47902
47903
  * @param {String | Number} jid_or_user_id - Jid or user id.
47903
47904
  * @returns {String} - jid.
47904
47905
  * */
47905
- typeChat: function(jid_or_user_id) {
47906
+ typeChat: function (jid_or_user_id) {
47906
47907
  var chatType;
47907
47908
  if (typeof jid_or_user_id === 'string') {
47908
47909
  chatType = jid_or_user_id.indexOf("muc") > -1 ? 'groupchat' : 'chat';
@@ -47919,12 +47920,12 @@ Helpers.prototype = {
47919
47920
  * @memberof QB.chat.helpers
47920
47921
  * @param {Array} occupantsIds - Array of user ids.
47921
47922
  * @param {Number} UserId - Jid or user id.
47922
- * @returns {Number} - Recipient id.
47923
+ * @returns {Number} recipient - recipient id.
47923
47924
  * */
47924
- getRecipientId: function(occupantsIds, UserId) {
47925
+ getRecipientId: function (occupantsIds, UserId) {
47925
47926
  var recipient = null;
47926
- occupantsIds.forEach(function(item) {
47927
- if(item != UserId){
47927
+ occupantsIds.forEach(function (item) {
47928
+ if (item != UserId) {
47928
47929
  recipient = item;
47929
47930
  }
47930
47931
  });
@@ -47938,8 +47939,8 @@ Helpers.prototype = {
47938
47939
  * @param {Number} appId - The application id.
47939
47940
  * @returns {String} jid - The user jid.
47940
47941
  * */
47941
- getUserJid: function(userId, appId) {
47942
- if(!appId){
47942
+ getUserJid: function (userId, appId) {
47943
+ if (!appId) {
47943
47944
  return userId + '-' + config.creds.appId + '@' + config.endpoints.chat;
47944
47945
  }
47945
47946
  return userId + '-' + appId + '@' + config.endpoints.chat;
@@ -47951,7 +47952,7 @@ Helpers.prototype = {
47951
47952
  * @param {Number} UserId - The user id.
47952
47953
  * @returns {String} mucDomainWithNick - The mac domain with he nick.
47953
47954
  * */
47954
- getUserNickWithMucDomain: function(userId) {
47955
+ getUserNickWithMucDomain: function (userId) {
47955
47956
  return config.endpoints.muc + '/' + userId;
47956
47957
  },
47957
47958
 
@@ -47961,7 +47962,7 @@ Helpers.prototype = {
47961
47962
  * @param {String} jid - The user jid.
47962
47963
  * @returns {Number} id - The user id.
47963
47964
  * */
47964
- getIdFromNode: function(jid) {
47965
+ getIdFromNode: function (jid) {
47965
47966
  return (jid.indexOf('@') < 0) ? null : parseInt(jid.split('@')[0].split('-')[0]);
47966
47967
  },
47967
47968
 
@@ -47971,7 +47972,7 @@ Helpers.prototype = {
47971
47972
  * @param {String} jid - The dialog jid.
47972
47973
  * @returns {String} dialogId - The dialog id.
47973
47974
  * */
47974
- getDialogIdFromNode: function(jid) {
47975
+ getDialogIdFromNode: function (jid) {
47975
47976
  if (jid.indexOf('@') < 0) return null;
47976
47977
  return jid.split('@')[0].split('_')[1];
47977
47978
  },
@@ -47982,7 +47983,7 @@ Helpers.prototype = {
47982
47983
  * @param {String} dialogId - The dialog id.
47983
47984
  * @returns {String} jid - The dialog jid.
47984
47985
  * */
47985
- getRoomJidFromDialogId: function(dialogId) {
47986
+ getRoomJidFromDialogId: function (dialogId) {
47986
47987
  return config.creds.appId + '_' + dialogId + '@' + config.endpoints.muc;
47987
47988
  },
47988
47989
 
@@ -47993,7 +47994,7 @@ Helpers.prototype = {
47993
47994
  * @param {String} userJid - user's jid.
47994
47995
  * @returns {String} jid - dialog's full jid.
47995
47996
  * */
47996
- getRoomJid: function(jid) {
47997
+ getRoomJid: function (jid) {
47997
47998
  return jid + '/' + this.getIdFromNode(this._userCurrentJid);
47998
47999
  },
47999
48000
 
@@ -48003,7 +48004,7 @@ Helpers.prototype = {
48003
48004
  * @param {String} jid - dialog's full jid.
48004
48005
  * @returns {String} user_id - User Id.
48005
48006
  * */
48006
- getIdFromResource: function(jid) {
48007
+ getIdFromResource: function (jid) {
48007
48008
  var s = jid.split('/');
48008
48009
  if (s.length < 2) return null;
48009
48010
  s.splice(0, 1);
@@ -48016,7 +48017,7 @@ Helpers.prototype = {
48016
48017
  * @param {String} jid - dialog's full jid.
48017
48018
  * @returns {String} room_jid - dialog's bare jid.
48018
48019
  * */
48019
- getRoomJidFromRoomFullJid: function(jid) {
48020
+ getRoomJidFromRoomFullJid: function (jid) {
48020
48021
  var s = jid.split('/');
48021
48022
  if (s.length < 2) return null;
48022
48023
  return s[0];
@@ -48027,7 +48028,7 @@ Helpers.prototype = {
48027
48028
  * @memberof QB.chat.helpers
48028
48029
  * @returns {String} BsonObjectId - The bson object id.
48029
48030
  **/
48030
- getBsonObjectId: function() {
48031
+ getBsonObjectId: function () {
48031
48032
  return Utils.getBsonObjectId();
48032
48033
  },
48033
48034
 
@@ -48037,17 +48038,17 @@ Helpers.prototype = {
48037
48038
  * @param {String} jid - resourse jid.
48038
48039
  * @returns {String} userId - The user id.
48039
48040
  * */
48040
- getUserIdFromRoomJid: function(jid) {
48041
+ getUserIdFromRoomJid: function (jid) {
48041
48042
  var arrayElements = jid.toString().split('/');
48042
- if(arrayElements.length === 0){
48043
+ if (arrayElements.length === 0) {
48043
48044
  return null;
48044
48045
  }
48045
- return arrayElements[arrayElements.length-1];
48046
+ return arrayElements[arrayElements.length - 1];
48046
48047
  },
48047
48048
 
48048
- userCurrentJid: function(client){
48049
+ userCurrentJid: function (client) {
48049
48050
  try {
48050
- if (client instanceof Strophe.Connection){
48051
+ if (client instanceof Strophe.Connection) {
48051
48052
  return client.jid;
48052
48053
  } else {
48053
48054
  return client.jid.user + '@' + client.jid._domain + '/' + client.jid._resource;
@@ -48057,15 +48058,15 @@ Helpers.prototype = {
48057
48058
  }
48058
48059
  },
48059
48060
 
48060
- getUserCurrentJid: function() {
48061
+ getUserCurrentJid: function () {
48061
48062
  return this._userCurrentJid;
48062
48063
  },
48063
48064
 
48064
- setUserCurrentJid: function(jid) {
48065
+ setUserCurrentJid: function (jid) {
48065
48066
  this._userCurrentJid = jid;
48066
48067
  },
48067
48068
 
48068
- getDialogJid: function(identifier) {
48069
+ getDialogJid: function (identifier) {
48069
48070
  return identifier.indexOf('@') > 0 ? identifier : this.getRoomJidFromDialogId(identifier);
48070
48071
  }
48071
48072
  };
@@ -53554,8 +53555,8 @@ module.exports = StreamManagement;
53554
53555
  */
53555
53556
 
53556
53557
  var config = {
53557
- version: '2.15.2',
53558
- buildNumber: '1143',
53558
+ version: '2.15.3',
53559
+ buildNumber: '1148',
53559
53560
  creds: {
53560
53561
  'appId': 0,
53561
53562
  'authKey': '',
@@ -53621,7 +53622,6 @@ var config = {
53621
53622
  addISOTime: false,
53622
53623
  qbTokenExpirationDate: null,
53623
53624
  liveSessionInterval: 120,
53624
- callBackInterval: 30,
53625
53625
  };
53626
53626
 
53627
53627
  config.set = function(options) {
@@ -53709,6 +53709,7 @@ QuickBlox.prototype = {
53709
53709
  * @param {Object} configMap - Settings object for QuickBlox SDK.
53710
53710
  */
53711
53711
  init: function(appIdOrToken, authKeyOrAppId, authSecret, accountKey, configMap) {
53712
+ console.log('current platform: ', Utils.getEnv());
53712
53713
  if (typeof accountKey === 'string' && accountKey.length) {
53713
53714
  if (configMap && typeof configMap === 'object') {
53714
53715
  config.set(configMap);
@@ -54090,7 +54091,7 @@ ServiceProxy.prototype = {
54090
54091
  qbFetch(qbUrl, qbRequest)
54091
54092
  .then(function(response) {
54092
54093
  qbResponse = response;
54093
-
54094
+ console.log('qbProxy fetch then 1');
54094
54095
  if (qbRequest.method === 'GET' || qbRequest.method === 'POST'){
54095
54096
  var qbTokenExpirationDate = qbResponse.headers.get('qb-token-expirationdate');
54096
54097
  var headerHasToken = !(qbTokenExpirationDate === null ||
@@ -54114,9 +54115,16 @@ ServiceProxy.prototype = {
54114
54115
 
54115
54116
  return ' ';
54116
54117
  }).then(function(body) {
54118
+ //console.log('HTTP status code: ', qbResponse.headers.status);
54119
+ //console.log('HTTP response: ', qbResponse);
54120
+ console.log('qbProxy fetch then 2');
54121
+ console.log('HTTP body: ', qbResponse);
54117
54122
  _requestCallback(null, qbResponse, body);
54118
54123
  }, function(error) {
54119
54124
  _requestCallback(error);
54125
+ }).catch((error) => {
54126
+ console.log('qbProxy fetch ... catch, error: ', error);
54127
+ _requestCallback(error);
54120
54128
  });
54121
54129
 
54122
54130
  /*