summaryrefslogtreecommitdiff
path: root/frontend/gamma/js/Clipperz/PM/Connection.js
Side-by-side diff
Diffstat (limited to 'frontend/gamma/js/Clipperz/PM/Connection.js') (more/less context) (ignore whitespace changes)
-rw-r--r--frontend/gamma/js/Clipperz/PM/Connection.js34
1 files changed, 29 insertions, 5 deletions
diff --git a/frontend/gamma/js/Clipperz/PM/Connection.js b/frontend/gamma/js/Clipperz/PM/Connection.js
index b4e8aaa..a05a310 100644
--- a/frontend/gamma/js/Clipperz/PM/Connection.js
+++ b/frontend/gamma/js/Clipperz/PM/Connection.js
@@ -43,2 +43,3 @@ Clipperz.PM.Connection = function (args) {
this._sharedSecret = null;
+ this._serverLockValue = null;
@@ -148,2 +149,12 @@ MochiKit.Logging.logError("### Connection.defaultErrorHandler: " + anErrorString
+ //-------------------------------------------------------------------------
+
+ 'serverLockValue': function () {
+ return this._serverLockValue;
+ },
+
+ 'setServerLockValue': function (aValue) {
+ this._serverLockValue = aValue;
+ },
+
//=========================================================================
@@ -322,3 +333,3 @@ Clipperz.PM.Connection.SRP['1.0'].prototype = MochiKit.Base.update(new Clipperz.
- 'login': function(/*anUsername, aPassphrase*/) {
+ 'login': function(isReconnecting) {
var deferredResult;
@@ -328,3 +339,2 @@ Clipperz.PM.Connection.SRP['1.0'].prototype = MochiKit.Base.update(new Clipperz.
cryptoVersion = this.clipperz_pm_crypto_version();
-
deferredResult = new Clipperz.Async.Deferred("Connection.login", {trace:false});
@@ -401,2 +411,9 @@ Clipperz.PM.Connection.SRP['1.0'].prototype = MochiKit.Base.update(new Clipperz.
// }
+
+ if ((isReconnecting == true) && (this.serverLockValue() != someParameters['lock'])) {
+ throw Clipperz.PM.Connection.exception.StaleData;
+ } else {
+ this.setServerLockValue(someParameters['lock']);
+ }
+
return someParameters;
@@ -431,2 +448,8 @@ Clipperz.PM.Connection.SRP['1.0'].prototype = MochiKit.Base.update(new Clipperz.
var args;
+ var parameters;
+
+ parameters = someParameters || {};
+ if (typeof(parameters['user']) != 'undefined') {
+ parameters['user']['lock'] = this.serverLockValue();
+ }
@@ -436,3 +459,4 @@ Clipperz.PM.Connection.SRP['1.0'].prototype = MochiKit.Base.update(new Clipperz.
srpSharedSecret: this.sharedSecret(),
- parameters: (someParameters || {})
+// parameters: (someParameters || {})
+ parameters: parameters
}
@@ -451,4 +475,3 @@ Clipperz.PM.Connection.SRP['1.0'].prototype = MochiKit.Base.update(new Clipperz.
if (typeof(res['lock']) != 'undefined') {
-// TODO: ?????
-// ?? this.user().setLock(res['lock']);
+ this.setServerLockValue(res['lock']);
}
@@ -589,2 +612,3 @@ Clipperz.PM.Connection.exception = {
WrongChecksum: new MochiKit.Base.NamedError("Clipperz.ByteArray.exception.InvalidValue"),
+ StaleData: new MochiKit.Base.NamedError("Stale data"),
UnexpectedRequest: new MochiKit.Base.NamedError("Clipperz.ByteArray.exception.UnexpectedRequest")