quickblox 2.16.2 → 2.16.4

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.
@@ -1893,18 +1893,51 @@ MucProxy.prototype = {
1893
1893
 
1894
1894
  delete this.joinedRooms[jid];
1895
1895
 
1896
+ function handleLeaveAnswer(stanza) {
1897
+ var id = chatUtils.getAttr(stanza, 'id');
1898
+ var from = chatUtils.getAttr(stanza, 'from');
1899
+ var dialogId = self.helpers.getDialogIdFromNode(from);
1900
+
1901
+ var x = chatUtils.getElement(stanza, 'x');
1902
+ var xXMLNS = chatUtils.getAttr(x, 'xmlns');
1903
+ var status = chatUtils.getElement(x, 'status');
1904
+ var statusCode = chatUtils.getAttr(status, 'code');
1905
+
1906
+ if (status && statusCode == '110') {
1907
+ Utils.safeCallbackCall(callback, null, {
1908
+ dialogId: dialogId
1909
+ });
1910
+ } else {
1911
+ var type = chatUtils.getAttr(stanza, 'type');
1912
+
1913
+ if (type && type === 'error' && xXMLNS == 'http://jabber.org/protocol/muc' && id.endsWith(':join')) {
1914
+ var errorEl = chatUtils.getElement(stanza, 'error');
1915
+ var code = chatUtils.getAttr(errorEl, 'code');
1916
+ var errorMessage = chatUtils.getElementText(errorEl, 'text');
1917
+
1918
+ Utils.safeCallbackCall(callback, {
1919
+ code: code || 500,
1920
+ message: errorMessage || 'Unknown issue'
1921
+ }, {
1922
+ dialogId: dialogId
1923
+ });
1924
+ }
1925
+ }
1926
+ }
1927
+
1896
1928
  if (Utils.getEnv().browser) {
1897
1929
  var roomJid = self.helpers.getRoomJid(jid);
1898
1930
 
1899
1931
  if (typeof callback === 'function') {
1900
- self.connection.XAddTrackedHandler(callback, null, 'presence', presParams.type, null, roomJid);
1932
+ self.connection.XAddTrackedHandler(handleLeaveAnswer, null, 'presence', presParams.type, null, roomJid);
1933
+
1901
1934
  }
1902
1935
 
1903
1936
  self.connection.send(pres);
1904
1937
  } else {
1905
1938
  /** The answer don't contain id */
1906
1939
  if (typeof callback === 'function') {
1907
- self.nodeStanzasCallbacks['muc:leave'] = callback;
1940
+ self.nodeStanzasCallbacks['muc:leave'] = handleLeaveAnswer;
1908
1941
  }
1909
1942
 
1910
1943
  self.Client.send(pres);
package/src/qbConfig.js CHANGED
@@ -12,8 +12,8 @@
12
12
  */
13
13
 
14
14
  var config = {
15
- version: '2.16.2',
16
- buildNumber: '1157',
15
+ version: '2.16.4',
16
+ buildNumber: '1159',
17
17
  creds: {
18
18
  'appId': 0,
19
19
  'authKey': '',