Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "quickblox",
"description": "QuickBlox JavaScript SDK",
"version": "2.3.0",
"version": "2.3.1",
"homepage": "https://quickblox.com/developers/Javascript",
"main": "quickblox.js",
"license": "Apache 2.0",
Expand Down
9 changes: 2 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
{
"name": "quickblox",
"description": "QuickBlox JavaScript SDK",
"version": "2.3.0",
"version": "2.3.1",
"homepage": "https://quickblox.com/developers/Javascript",
"main": "src/qbMain.js",
"license": [
{
"type": "Apache 2.0",
"url": "https://github.com/QuickBlox/quickblox-javascript-sdk/blob/master/LICENSE"
}
],
"license" : "(Apache-2.0)",
"keywords": [
"quickblox",
"javascript",
Expand Down
34 changes: 17 additions & 17 deletions quickblox.min.js

Large diffs are not rendered by default.

34 changes: 17 additions & 17 deletions spec/QB-ChatSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ describe('Chat API', function() {
}

QB.chat.onSystemMessageListener = onSystemMessageListenerCb;

QB.chat.sendSystemMessage(QBUser1.id, {'extension': extension});
}, MESSAGING_TIMEOUT);

Expand Down Expand Up @@ -209,18 +209,18 @@ describe('Chat API', function() {
});

describe('[Roster] Contact list: ', function() {
it('can retrieve contact list', function(done) {
QB.chat.roster.get(function(roster) {
expect(roster).toBeDefined();
expect(roster).toEqual(jasmine.any(Object));

/** !!Don't give back any response */
it('can add user to contact list', function(done) {
QB.chat.roster.add(QBUser2.id, function() {
done();
});
}, IQ_TIMEOUT);

/** !!Don't give back any response */
it('can add user to contact list', function(done) {
QB.chat.roster.add(QBUser2.id, function() {
it('can retrieve contact list', function(done) {
QB.chat.roster.get(function(roster) {
expect(roster).toBeDefined();
expect(QBUser2.id in roster).toEqual(true);

done();
});
}, IQ_TIMEOUT);
Expand Down Expand Up @@ -268,7 +268,7 @@ describe('Chat API', function() {

QB.chat.privacylist.update(list, function(error) {
expect(error).toBeDefined();

done();
});
});
Expand All @@ -287,7 +287,7 @@ describe('Chat API', function() {
it('can set active list', function(done) {
QB.chat.privacylist.setAsActive('test', function(error) {
expect(error).toBeNull();

done();
});
});
Expand Down Expand Up @@ -339,7 +339,7 @@ describe('Chat API', function() {
describe('REST API', function() {
var dialogId;
var messageId;

it('can create a dialog (group)', function(done) {
var params = {
occupants_ids: [QBUser2.id],
Expand Down Expand Up @@ -372,7 +372,7 @@ describe('Chat API', function() {
var filters = null;
QB.chat.dialog.list(filters, function(err, res) {
expect(err).toBeNull();

expect(res).not.toBeNull();
expect(res.items.length).toBeGreaterThan(0);

Expand Down Expand Up @@ -423,7 +423,7 @@ describe('Chat API', function() {

QB.chat.message.list(filters, function(err, res) {
expect(err).toBeNull();

expect(res).not.toBeNull();
expect(res.items.length).toBeGreaterThan(0);

Expand All @@ -436,7 +436,7 @@ describe('Chat API', function() {

QB.chat.message.unreadCount(params, function(err, res) {
expect(err).toBeNull();

expect(res.total).toEqual(0);
expect(res[dialogId]).toEqual(0);

Expand All @@ -463,7 +463,7 @@ describe('Chat API', function() {
it('can delete a message with id', function(done) {
QB.chat.message.delete([messageId, 'notExistentId'], {force: 1}, function(err, res) {
expect(err).toBeNull();

done();

messageId = null;
Expand Down Expand Up @@ -493,4 +493,4 @@ describe('Chat API', function() {
//
// QB.chat.disconnect();
// }, REST_REQUESTS_TIMEOUT);
});
});
27 changes: 13 additions & 14 deletions src/modules/qbChat.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ function ChatProxy(service, webrtcModule, conn) {
return;
}
}

/** JOIN to dialog */
if(stanza.attrs.id) {
if(status && status.attrs.code == "110"){
Expand Down Expand Up @@ -383,15 +383,15 @@ ChatProxy.prototype = {
break;
case Strophe.Status.AUTHFAIL:
err = Utils.getError(401, 'Status.AUTHFAIL - The authentication attempt failed');

if (typeof callback === 'function') {
callback(err, null);
}

if(self._isDisconnected && typeof self.onReconnectFailedListener === 'function'){
Utils.safeCallbackCall(self.onReconnectFailedListener, err);
}

break;
case Strophe.Status.CONNECTED:
Utils.QBLog('[ChatProxy]', 'Status.CONNECTED at ' + chatUtils.getLocalTime());
Expand All @@ -413,7 +413,7 @@ ChatProxy.prototype = {

// enable carbons
self._enableCarbons();

// get the roster
self.roster.get(function(contacts) {
roster = contacts;
Expand Down Expand Up @@ -502,7 +502,7 @@ ChatProxy.prototype = {

nClient.on('reconnect', function () {
Utils.QBLog('[QBChat] client is reconnected');

self._isDisconnected = true;
self._isLogout = true;
});
Expand All @@ -519,9 +519,9 @@ ChatProxy.prototype = {

nClient.on('stanza', function (stanza) {
Utils.QBLog('[QBChat] RECV', stanza.toString());

/**
* Detect typeof incoming stanza
* Detect typeof incoming stanza
* and fire the Listener
*/
if (stanza.is('presence')) {
Expand Down Expand Up @@ -835,11 +835,10 @@ RosterProxy.prototype = {
var items = _getItems(stanza);
/** TODO */
for (var i = 0, len = items.length; i < len; i++) {
var userId = chatUtils.getAttr(items[i], 'name'),
var userId = self.helpers.getIdFromNode( chatUtils.getAttr(items[i], 'jid') ),
ask = chatUtils.getAttr(items[i], 'ask'),
subscription = chatUtils.getAttr(items[i], 'subscription');


contacts[userId] = {
subscription: subscription,
ask: ask || null
Expand Down Expand Up @@ -968,7 +967,7 @@ RosterProxy.prototype = {
};

var pres = chatUtils.createStanza(builder, presParams, 'presence');

Utils.QBLog('[_sendSubscriptionPresence]', params);

if(Utils.getEnv().browser){
Expand Down Expand Up @@ -1091,7 +1090,7 @@ MucProxy.prototype = {
connection.sendIQ(iq, function(stanza) {
var items = stanza.getElementsByTagName('item'),
userId;

for (var i = 0, len = items.length; i < len; i++) {
userId = self.helpers.getUserIdFromRoomJid(items[i].getAttribute('jid'));
onlineUsers.push(userId);
Expand Down Expand Up @@ -1121,7 +1120,7 @@ PrivacyListProxy.prototype = {
create: function(list, callback) {
var self = this,
userId, userJid, userMuc,
userAction,
userAction,
mutualBlock,
listPrivacy = {},
listUserId = [];
Expand All @@ -1148,7 +1147,7 @@ PrivacyListProxy.prototype = {

var iq = chatUtils.createStanza(builder, iqParams, 'iq');

iq.c('query', {
iq.c('query', {
xmlns: chatUtils.MARKERS.PRIVACY
}).c('list', {
name: list.name
Expand Down Expand Up @@ -1783,4 +1782,4 @@ Helpers.prototype = {
}
};

module.exports = ChatProxy;
module.exports = ChatProxy;
2 changes: 1 addition & 1 deletion src/qbConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/

var config = {
version: '2.3.0',
version: '2.3.1',
creds: {
appId: '',
authKey: '',
Expand Down