quickblox 2.22.0-alpha.1 → 2.23.0-beta.1

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.
@@ -299,7 +299,13 @@ function ChatProxy(service) {
299
299
  var from = chatUtils.getAttr(stanza, 'from'),
300
300
  to = chatUtils.getAttr(stanza, 'to'),
301
301
  type = chatUtils.getAttr(stanza, 'type'),
302
- messageId = chatUtils.getAttr(stanza, 'id'),
302
+ messageId = chatUtils.getAttr(stanza, 'id');
303
+
304
+ // [QC-1454 DIAGNOSTIC] Log every _onMessage invocation
305
+ Utils.QBLog('[QBChat]', '[MSG_HANDLER] _onMessage invoked: type=' + type +
306
+ ' from=' + from + ' id=' + messageId);
307
+
308
+ var
303
309
  markable = chatUtils.getElement(stanza, 'markable'),
304
310
  delivered = chatUtils.getElement(stanza, 'received'),
305
311
  read = chatUtils.getElement(stanza, 'displayed'),
@@ -391,6 +397,9 @@ function ChatProxy(service) {
391
397
  }
392
398
 
393
399
  if (typeof self.onMessageListener === 'function' && (type === 'chat' || type === 'groupchat')) {
400
+ // [QC-1454 DIAGNOSTIC] Log before calling app's message listener
401
+ Utils.QBLog('[QBChat]', '[MSG_HANDLER] Calling onMessageListener: type=' + type +
402
+ ' userId=' + userId + ' msgId=' + messageId);
394
403
  Utils.safeCallbackCall(self.onMessageListener, userId, message);
395
404
  }
396
405
 
@@ -416,6 +425,15 @@ function ChatProxy(service) {
416
425
  }
417
426
  }
418
427
 
428
+ // [QC-1454 DIAGNOSTIC] Log all MUC-related presences
429
+ if (xXMLNS && xXMLNS.indexOf('muc') !== -1) {
430
+ Utils.QBLog('[QBChat]', '[MUC_PRESENCE] from=' + from +
431
+ ' type=' + (type || 'available') +
432
+ ' statusCode=' + (statusCode || 'none') +
433
+ ' id=' + id +
434
+ ' xmlns=' + xXMLNS);
435
+ }
436
+
419
437
  // MUC presences go here
420
438
  if (xXMLNS && xXMLNS == 'http://jabber.org/protocol/muc#user') {
421
439
  dialogId = self.helpers.getDialogIdFromNode(from);
@@ -866,6 +884,10 @@ ChatProxy.prototype = {
866
884
  self.connection.XAddTrackedHandler(self._onSystemMessageListener, null, 'message', 'headline');
867
885
  self.connection.XAddTrackedHandler(self._onMessageErrorListener, null, 'message', 'error');
868
886
 
887
+ // [QC-1454 DIAGNOSTIC] Log handler count after re-registration
888
+ Utils.QBLog('[QBChat]', '[HANDLERS] Registered handler count after reconnect: ' +
889
+ self.connection.XHandlerReferences.length);
890
+
869
891
  var noTimerId = typeof self._checkConnectionPingTimer === 'undefined';
870
892
  noTimerId = config.pingLocalhostTimeInterval === 0 ? false : noTimerId;
871
893
 
@@ -1150,12 +1172,29 @@ ChatProxy.prototype = {
1150
1172
 
1151
1173
  xmppClient.send(presence);
1152
1174
 
1153
- Utils.QBLog('[QBChat]', 'Re-joining ' + rooms.length + " rooms...");
1175
+ Utils.QBLog('[QBChat]', 'Re-joining ' + rooms.length + ' rooms...');
1154
1176
 
1177
+ // [QC-1454 DIAGNOSTIC] Log each MUC re-join with callback to track server confirmation
1178
+ /* jshint -W083 */
1155
1179
  for (var i = 0, len = rooms.length; i < len; i++) {
1156
- self.muc.join(rooms[i]);
1180
+ (function(roomJid, index) {
1181
+ Utils.QBLog('[QBChat]', '[MUC_REJOIN] Sending join for room ' +
1182
+ (index + 1) + '/' + len + ': ' + roomJid);
1183
+ self.muc.join(roomJid, function(errorOrStanza, result) {
1184
+ if (result && result.dialogId) {
1185
+ Utils.QBLog('[QBChat]', '[MUC_REJOIN] Room join CONFIRMED by server: ' +
1186
+ 'dialogId=' + result.dialogId + ' room=' + roomJid);
1187
+ } else {
1188
+ Utils.QBLog('[QBChat]', '[MUC_REJOIN] Room join RESPONSE (possible error): ' +
1189
+ 'room=' + roomJid + ' error=' + JSON.stringify(errorOrStanza));
1190
+ }
1191
+ });
1192
+ })(rooms[i], i);
1157
1193
  }
1158
1194
 
1195
+ Utils.QBLog('[QBChat]', '[MUC_REJOIN] All ' + rooms.length +
1196
+ ' join presences sent. Awaiting server confirmations...');
1197
+
1159
1198
  if (typeof self.onReconnectListener === 'function') {
1160
1199
  Utils.safeCallbackCall(self.onReconnectListener);
1161
1200
  }
@@ -287,6 +287,14 @@ var qbChatHelpers = {
287
287
  delete extension.moduleIdentifier;
288
288
  }
289
289
 
290
+ if (extension.date_sent) {
291
+ var parsedDateSent = Number(extension.date_sent);
292
+
293
+ if (Number.isFinite(parsedDateSent)) {
294
+ extension.date_sent = Math.trunc(parsedDateSent).toString();
295
+ }
296
+ }
297
+
290
298
  return {
291
299
  extension: extension,
292
300
  dialogId: dialogId
@@ -56,6 +56,14 @@ DialogProxy.prototype = {
56
56
  params.occupants_ids = params.occupants_ids.join(', ');
57
57
  }
58
58
 
59
+ if (params && params.is_join_required !== undefined && params.is_join_required !== null) {
60
+ if (params.is_join_required !== 0 && params.is_join_required !== 1) {
61
+ Utils.QBLog('[QBChat]', 'Warning: is_join_required must be 0 or 1, got: ' +
62
+ params.is_join_required + '. Parameter ignored.');
63
+ delete params.is_join_required;
64
+ }
65
+ }
66
+
59
67
  this.service.ajax({
60
68
  url: Utils.getUrl(DIALOGS_API_URL),
61
69
  type: 'POST',
@@ -78,6 +86,11 @@ DialogProxy.prototype = {
78
86
  * @callback updateDialogCallback
79
87
  * */
80
88
 
89
+ if (params && params.is_join_required !== undefined) {
90
+ Utils.QBLog('[QBChat]', 'Warning: is_join_required is not supported in dialog.update(). Parameter ignored.');
91
+ delete params.is_join_required;
92
+ }
93
+
81
94
  this.service.ajax({
82
95
  'url': Utils.getUrl(DIALOGS_API_URL, id),
83
96
  'type': 'PUT',
package/src/qbConfig.js CHANGED
@@ -12,8 +12,8 @@
12
12
  */
13
13
 
14
14
  var config = {
15
- version: '2.22.0',
16
- buildNumber: '1176',
15
+ version: '2.23.0-beta.1',
16
+ buildNumber: '1178',
17
17
  creds: {
18
18
  'appId': 0,
19
19
  'authKey': '',
package/src/qbStrophe.js CHANGED
@@ -74,6 +74,11 @@ function Connection(onLogListenerCallback) {
74
74
  Utils.QBLog('[QBChat]', 'RECV:', data);
75
75
  safeCallbackCall('RECV:', data);
76
76
 
77
+ // [QC-1454 DIAGNOSTIC] Flag groupchat messages at transport level
78
+ if (typeof data === 'string' && data.indexOf('groupchat') !== -1) {
79
+ Utils.QBLog('[QBChat]', '[TRANSPORT] Groupchat stanza received at WebSocket level');
80
+ }
81
+
77
82
  try {
78
83
  let parser = new DOMParser();
79
84
  let xmlDoc = parser.parseFromString(data, 'text/xml');