Commit 1da343b4fb1bb3b2b9cf649cc0575cead2942c5f
Merge branch 'inform-if-expired' of /home/git/repositories/openwapp/coseme
Showing 5 changed files
.gitignore
View file @
1da343b
dist/coseme.js
View file @
1da343b
... | ... | @@ -6436,6 +6436,11 @@ |
6436 | 6436 | return callback('expired'); |
6437 | 6437 | } |
6438 | 6438 | logger.log('Authentication success!'); |
6439 | + var expiration = successTree.getAttributeValue('expiration'); | |
6440 | + expiration = parseInt(expiration, 10); | |
6441 | + if (!isNaN(expiration)) { | |
6442 | + connection.expiration = new Date(expiration * 1000); | |
6443 | + } | |
6439 | 6444 | setNextChallenge(successTree.data); |
6440 | 6445 | callback(null); |
6441 | 6446 | } |
... | ... | @@ -8025,6 +8030,7 @@ |
8025 | 8030 | try { |
8026 | 8031 | if (!err && aConn) { |
8027 | 8032 | self.socket = aConn; |
8033 | + self.expiration = aConn.expiration; | |
8028 | 8034 | self.socket.onconnectionclosed = self._onErrorSendDisconnected; |
8029 | 8035 | self.socket.onconnectionlost = self._onErrorSendDisconnected; |
8030 | 8036 | self.readerThread.socket = self.socket; |
... | ... | @@ -8384,6 +8390,10 @@ |
8384 | 8390 | }, |
8385 | 8391 | |
8386 | 8392 | getVersion: function() { return CoSeMe.config.tokenData['v']; }, |
8393 | + | |
8394 | + getExpirationDate: function () { | |
8395 | + return self.expiration; | |
8396 | + }, | |
8387 | 8397 | |
8388 | 8398 | disconnect: function(aReason) { |
8389 | 8399 | logger.log('Disconnect sequence initiated...'); |
dist/coseme.min.js
View file @
1da343b
src/auth/auth.js
View file @
1da343b
... | ... | @@ -188,6 +188,11 @@ |
188 | 188 | return callback('expired'); |
189 | 189 | } |
190 | 190 | logger.log('Authentication success!'); |
191 | + var expiration = successTree.getAttributeValue('expiration'); | |
192 | + expiration = parseInt(expiration, 10); | |
193 | + if (!isNaN(expiration)) { | |
194 | + connection.expiration = new Date(expiration * 1000); | |
195 | + } | |
191 | 196 | setNextChallenge(successTree.data); |
192 | 197 | callback(null); |
193 | 198 | } |
src/yowsup_if.js
View file @
1da343b
... | ... | @@ -1378,6 +1378,7 @@ |
1378 | 1378 | try { |
1379 | 1379 | if (!err && aConn) { |
1380 | 1380 | self.socket = aConn; |
1381 | + self.expiration = aConn.expiration; | |
1381 | 1382 | self.socket.onconnectionclosed = self._onErrorSendDisconnected; |
1382 | 1383 | self.socket.onconnectionlost = self._onErrorSendDisconnected; |
1383 | 1384 | self.readerThread.socket = self.socket; |
... | ... | @@ -1737,6 +1738,10 @@ |
1737 | 1738 | }, |
1738 | 1739 | |
1739 | 1740 | getVersion: function() { return CoSeMe.config.tokenData['v']; }, |
1741 | + | |
1742 | + getExpirationDate: function () { | |
1743 | + return self.expiration; | |
1744 | + }, | |
1740 | 1745 | |
1741 | 1746 | disconnect: function(aReason) { |
1742 | 1747 | logger.log('Disconnect sequence initiated...'); |