Skip to content

Commit 3229781

Browse files
authored
Merge pull request #152 from QuickBlox/gh-pages.autoSendPresenceUpdate
send initial presence if one of client (instance) goes offline
2 parents 47fb439 + 51f7803 commit 3229781

File tree

6 files changed

+17
-10
lines changed

6 files changed

+17
-10
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ For correct work of JS SDK you must include the library in your html before `qu
2020

2121
```html
2222
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
23-
<script src="https://cdnjs.cloudflare.com/ajax/libs/quickblox/2.2.2/quickblox.min.js"></script>
23+
<script src="https://cdnjs.cloudflare.com/ajax/libs/quickblox/2.2.3/quickblox.min.js"></script>
2424
```
2525

2626
## Bower and RequireJS

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "quickblox",
33
"description": "QuickBlox JavaScript SDK",
4-
"version": "2.2.2",
4+
"version": "2.2.3",
55
"homepage": "https://quickblox.com/developers/Javascript",
66
"main": "quickblox.js",
77
"license": "Apache 2.0",

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "quickblox",
33
"description": "QuickBlox JavaScript SDK",
4-
"version": "2.2.2",
4+
"version": "2.2.3",
55
"homepage": "https://quickblox.com/developers/Javascript",
66
"main": "src/qbMain.js",
77
"license": [

quickblox.min.js

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/modules/qbChat.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,10 @@ function ChatProxy(service, webrtcModule, conn) {
159159

160160
this._onPresence = function(stanza) {
161161
var from = stanza.getAttribute('from'),
162+
to = stanza.getAttribute('to'),
162163
type = stanza.getAttribute('type'),
163-
userId = self.helpers.getIdFromNode(from);
164+
userId = self.helpers.getIdFromNode(from),
165+
currentUserId = self.helpers.getIdFromNode(connection.jid);
164166

165167
if (!type) {
166168
if (typeof self.onContactListListener === 'function' && roster[userId] && roster[userId].subscription !== 'none')
@@ -216,8 +218,13 @@ function ChatProxy(service, webrtcModule, conn) {
216218
// self.onRejectSubscribeListener(userId);
217219
break;
218220
case 'unavailable':
219-
if (typeof self.onContactListListener === 'function' && roster[userId] && roster[userId].subscription !== 'none')
221+
if (typeof self.onContactListListener === 'function' && roster[userId] && roster[userId].subscription !== 'none') {
220222
Utils.safeCallbackCall(self.onContactListListener, userId, type);
223+
}
224+
// send initial presence if one of client (instance) goes offline
225+
if (userId === currentUserId) {
226+
connection.send($pres().tree());
227+
}
221228
break;
222229
}
223230

src/qbConfig.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*/
1111

1212
var config = {
13-
version: '2.2.2',
13+
version: '2.2.3',
1414
creds: {
1515
appId: '',
1616
authKey: '',

0 commit comments

Comments
 (0)