Skip to content

Commit ac3f260

Browse files
committed
The initial presence after connect to chat was fixed
1 parent b79db60 commit ac3f260

File tree

3 files changed

+29
-9
lines changed

3 files changed

+29
-9
lines changed

quickblox.min.js

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

src/modules/chat/qbChat.js

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -739,11 +739,15 @@ ChatProxy.prototype = {
739739
// get the roster and save
740740
self.roster.get(function(contacts) {
741741
self.roster.contacts = contacts;
742+
// send first presence if user is online
743+
self.connection.send($pres());
742744
});
743745
} else {
744746
// get the roster and save
745747
self.roster.get(function(contacts) {
746748
self.roster.contacts = contacts;
749+
// send first presence if user is online
750+
self.connection.send($pres());
747751
// connected and return roster as result
748752
callback(null, self.roster.contacts);
749753
});
@@ -762,9 +766,6 @@ ChatProxy.prototype = {
762766
}
763767
}
764768

765-
// chat server will close your connection if you are not active in chat during one minute
766-
// initial presence and an automatic reminder of it each 55 seconds
767-
self.connection.send($pres());
768769
break;
769770
case Strophe.Status.DISCONNECTING:
770771
Utils.QBLog('[Chat]', 'Status.DISCONNECTING');
@@ -817,12 +818,31 @@ ChatProxy.prototype = {
817818

818819
self.helpers.setUserCurrentJid(self.helpers.userCurrentJid(self.Client));
819820

820-
/** Send first presence if user is online */
821-
var presence = chatUtils.createStanza(XMPP.Stanza, null,'presence');
822-
self.Client.send(presence);
821+
// enable carbons
822+
self._enableCarbons();
823823

824824
if (typeof callback === 'function') {
825-
callback(null, true);
825+
var presence = chatUtils.createStanza(XMPP.Stanza, null,'presence');
826+
827+
if (params.connectWithoutGettingRoster) {
828+
// connected and return nothing as result
829+
callback(null, undefined);
830+
// get the roster and save
831+
self.roster.get(function(contacts) {
832+
self.roster.contacts = contacts;
833+
// send first presence if user is online
834+
self.Client.send(presence);
835+
});
836+
} else {
837+
// get the roster and save
838+
self.roster.get(function(contacts) {
839+
self.roster.contacts = contacts;
840+
// send first presence if user is online
841+
self.Client.send(presence);
842+
// connected and return roster as result
843+
callback(null, self.roster.contacts);
844+
});
845+
}
826846
}
827847
});
828848

src/qbConfig.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
var config = {
1515
version: '2.8.1',
16-
buildNumber: '1069',
16+
buildNumber: '1070',
1717
creds: {
1818
appId: '',
1919
authKey: '',

0 commit comments

Comments
 (0)