author | Clipperz <info@clipperz.com> | 2013-01-31 13:42:04 (UTC) |
---|---|---|
committer | Clipperz <info@clipperz.com> | 2013-01-31 13:42:04 (UTC) |
commit | 07d0357beef5d9328a2dd8d07ad7b39c87ac55e4 (patch) (unidiff) | |
tree | f7a4aed8848302db153c2a211f8e58b944eb4c5b /frontend/gamma/js/Clipperz/PM/DataModel/User.js | |
parent | 767a3dcf48b6ac911c088af5dd7738a728eb6b99 (diff) | |
download | clipperz-07d0357beef5d9328a2dd8d07ad7b39c87ac55e4.zip clipperz-07d0357beef5d9328a2dd8d07ad7b39c87ac55e4.tar.gz clipperz-07d0357beef5d9328a2dd8d07ad7b39c87ac55e4.tar.bz2 |
Updated Copyright claims
- updated reference dates;
- removed reference to Community Edition;
- normalized logging using Clipperz.log[Warn|Error|Debug]
Diffstat (limited to 'frontend/gamma/js/Clipperz/PM/DataModel/User.js') (more/less context) (ignore whitespace changes)
-rw-r--r-- | frontend/gamma/js/Clipperz/PM/DataModel/User.js | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/frontend/gamma/js/Clipperz/PM/DataModel/User.js b/frontend/gamma/js/Clipperz/PM/DataModel/User.js index 646ce21..fd18faf 100644 --- a/frontend/gamma/js/Clipperz/PM/DataModel/User.js +++ b/frontend/gamma/js/Clipperz/PM/DataModel/User.js | |||
@@ -1,86 +1,84 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 24 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
27 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } | 25 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } |
28 | if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; } | 26 | if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; } |
29 | 27 | ||
30 | 28 | ||
31 | //############################################################################# | 29 | //############################################################################# |
32 | 30 | ||
33 | Clipperz.PM.DataModel.User = function (args) { | 31 | Clipperz.PM.DataModel.User = function (args) { |
34 | args = args || {}; | 32 | args = args || {}; |
35 | 33 | ||
36 | Clipperz.PM.DataModel.User.superclass.constructor.apply(this, arguments); | 34 | Clipperz.PM.DataModel.User.superclass.constructor.apply(this, arguments); |
37 | 35 | ||
38 | this._username = args.username || null; | 36 | this._username = args.username || null; |
39 | this._getPassphraseFunction = args.getPassphraseFunction || null; | 37 | this._getPassphraseFunction = args.getPassphraseFunction || null; |
40 | 38 | ||
41 | this._data = null; | 39 | this._data = null; |
42 | 40 | ||
43 | this._connection = null; | 41 | this._connection = null; |
44 | this._connectionVersion = 'current'; | 42 | this._connectionVersion = 'current'; |
45 | 43 | ||
46 | this._serverData = null; | 44 | this._serverData = null; |
47 | //this._serverLockValue = null; | 45 | //this._serverLockValue = null; |
48 | this._transientState = null; | 46 | this._transientState = null; |
49 | 47 | ||
50 | this._deferredLocks = { | 48 | this._deferredLocks = { |
51 | 'passphrase': new MochiKit.Async.DeferredLock(), | 49 | 'passphrase': new MochiKit.Async.DeferredLock(), |
52 | 'serverData': new MochiKit.Async.DeferredLock(), | 50 | 'serverData': new MochiKit.Async.DeferredLock(), |
53 | // 'recordsIndex': new MochiKit.Async.DeferredLock(), | 51 | // 'recordsIndex': new MochiKit.Async.DeferredLock(), |
54 | // 'directLoginsIndex':new MochiKit.Async.DeferredLock() | 52 | // 'directLoginsIndex':new MochiKit.Async.DeferredLock() |
55 | // 'preferences': new MochiKit.Async.DeferredLock() | 53 | // 'preferences': new MochiKit.Async.DeferredLock() |
56 | // 'oneTimePasswords': new MochiKit.Async.DeferredLock() | 54 | // 'oneTimePasswords': new MochiKit.Async.DeferredLock() |
57 | '__syntaxFix__': 'syntax fix' | 55 | '__syntaxFix__': 'syntax fix' |
58 | }; | 56 | }; |
59 | 57 | ||
60 | return this; | 58 | return this; |
61 | } | 59 | } |
62 | 60 | ||
63 | Clipperz.Base.extend(Clipperz.PM.DataModel.User, Object, { | 61 | Clipperz.Base.extend(Clipperz.PM.DataModel.User, Object, { |
64 | 62 | ||
65 | 'toString': function () { | 63 | 'toString': function () { |
66 | return "Clipperz.PM.DataModel.User - " + this.username(); | 64 | return "Clipperz.PM.DataModel.User - " + this.username(); |
67 | }, | 65 | }, |
68 | 66 | ||
69 | //------------------------------------------------------------------------- | 67 | //------------------------------------------------------------------------- |
70 | 68 | ||
71 | 'username': function () { | 69 | 'username': function () { |
72 | return this._username; | 70 | return this._username; |
73 | }, | 71 | }, |
74 | 72 | ||
75 | 'setUsername': function (aValue) { | 73 | 'setUsername': function (aValue) { |
76 | this._username = aValue; | 74 | this._username = aValue; |
77 | }, | 75 | }, |
78 | 76 | ||
79 | //------------------------------------------------------------------------- | 77 | //------------------------------------------------------------------------- |
80 | 78 | ||
81 | 'displayName': function() { | 79 | 'displayName': function() { |
82 | return "" + this.username() + ""; | 80 | return "" + this.username() + ""; |
83 | }, | 81 | }, |
84 | 82 | ||
85 | //------------------------------------------------------------------------- | 83 | //------------------------------------------------------------------------- |
86 | 84 | ||
@@ -267,218 +265,216 @@ Clipperz.Base.extend(Clipperz.PM.DataModel.User, Object, { | |||
267 | this.setConnectionVersion(Clipperz.PM.Connection.communicationProtocol.fallbackVersions[this.connectionVersion()]); | 265 | this.setConnectionVersion(Clipperz.PM.Connection.communicationProtocol.fallbackVersions[this.connectionVersion()]); |
268 | 266 | ||
269 | if (this.connectionVersion() != null) { | 267 | if (this.connectionVersion() != null) { |
270 | result = new Clipperz.Async.Deferred("User.handleConnectionFallback - retry"); | 268 | result = new Clipperz.Async.Deferred("User.handleConnectionFallback - retry"); |
271 | 269 | ||
272 | result.addMethod(this, 'login'); | 270 | result.addMethod(this, 'login'); |
273 | result.callback(); | 271 | result.callback(); |
274 | } else { | 272 | } else { |
275 | result = Clipperz.Async.callbacks("User.handleConnectionFallback - failed", [ | 273 | result = Clipperz.Async.callbacks("User.handleConnectionFallback - failed", [ |
276 | MochiKit.Base.method(this.data(), 'removeValue', 'passphrase'), | 274 | MochiKit.Base.method(this.data(), 'removeValue', 'passphrase'), |
277 | MochiKit.Base.method(this, 'setConnectionVersion', 'current'), | 275 | MochiKit.Base.method(this, 'setConnectionVersion', 'current'), |
278 | MochiKit.Base.partial(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'userLoginFailed'), | 276 | MochiKit.Base.partial(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'userLoginFailed'), |
279 | MochiKit.Base.partial(MochiKit.Async.fail, Clipperz.PM.DataModel.User.exception.LoginFailed) | 277 | MochiKit.Base.partial(MochiKit.Async.fail, Clipperz.PM.DataModel.User.exception.LoginFailed) |
280 | ], {trace:false}); | 278 | ], {trace:false}); |
281 | } | 279 | } |
282 | } | 280 | } |
283 | 281 | ||
284 | return result; | 282 | return result; |
285 | }, | 283 | }, |
286 | 284 | ||
287 | //------------------------------------------------------------------------- | 285 | //------------------------------------------------------------------------- |
288 | 286 | ||
289 | 'lock': function () { | 287 | 'lock': function () { |
290 | return Clipperz.Async.callbacks("User.lock", [ | 288 | return Clipperz.Async.callbacks("User.lock", [ |
291 | MochiKit.Base.method(this, 'deleteAllCleanTextData') | 289 | MochiKit.Base.method(this, 'deleteAllCleanTextData') |
292 | ], {trace:false}); | 290 | ], {trace:false}); |
293 | }, | 291 | }, |
294 | 292 | ||
295 | //------------------------------------------------------------------------- | 293 | //------------------------------------------------------------------------- |
296 | 294 | ||
297 | 'logout': function () { | 295 | 'logout': function () { |
298 | return Clipperz.Async.callbacks("User.logout", [ | 296 | return Clipperz.Async.callbacks("User.logout", [ |
299 | MochiKit.Base.method(this, 'deleteAllCleanTextData'), | 297 | MochiKit.Base.method(this, 'deleteAllCleanTextData'), |
300 | MochiKit.Base.method(this.connection(), 'logout') | 298 | MochiKit.Base.method(this.connection(), 'logout') |
301 | ], {trace:false}); | 299 | ], {trace:false}); |
302 | }, | 300 | }, |
303 | 301 | ||
304 | //------------------------------------------------------------------------- | 302 | //------------------------------------------------------------------------- |
305 | 303 | ||
306 | 'headerFormatVersion': function(anHeader) { | 304 | 'headerFormatVersion': function(anHeader) { |
307 | var result; | 305 | var result; |
308 | 306 | ||
309 | if (anHeader.charAt(0) == '{') { | 307 | if (anHeader.charAt(0) == '{') { |
310 | varheaderData; | 308 | varheaderData; |
311 | 309 | ||
312 | headerData = Clipperz.Base.evalJSON(anHeader); | 310 | headerData = Clipperz.Base.evalJSON(anHeader); |
313 | result = headerData['version']; | 311 | result = headerData['version']; |
314 | } else { | 312 | } else { |
315 | result = 'LEGACY'; | 313 | result = 'LEGACY'; |
316 | } | 314 | } |
317 | 315 | ||
318 | return result; | 316 | return result; |
319 | }, | 317 | }, |
320 | 318 | ||
321 | //------------------------------------------------------------------------- | 319 | //------------------------------------------------------------------------- |
322 | 320 | ||
323 | 'unpackServerData': function (someServerData) { | 321 | 'unpackServerData': function (someServerData) { |
324 | var unpackedData; | 322 | var unpackedData; |
325 | var headerVersion; | 323 | var headerVersion; |
326 | 324 | ||
327 | varrecordsIndex; | 325 | varrecordsIndex; |
328 | var preferences; | 326 | var preferences; |
329 | var oneTimePasswords; | 327 | var oneTimePasswords; |
330 | 328 | ||
331 | //console.log(">>> ***************** user.unpackServerData", someServerData); | ||
332 | // this.setServerLockValue(someServerData['lock']); | 329 | // this.setServerLockValue(someServerData['lock']); |
333 | 330 | ||
334 | headerVersion = this.headerFormatVersion(someServerData['header']); | 331 | headerVersion = this.headerFormatVersion(someServerData['header']); |
335 | 332 | ||
336 | switch (headerVersion) { | 333 | switch (headerVersion) { |
337 | case 'LEGACY': | 334 | case 'LEGACY': |
338 | varlegacyHeader; | 335 | varlegacyHeader; |
339 | 336 | ||
340 | legacyHeader = new Clipperz.PM.DataModel.User.Header.Legacy({ | 337 | legacyHeader = new Clipperz.PM.DataModel.User.Header.Legacy({ |
341 | 'retrieveKeyFunction': MochiKit.Base.method(this, 'getPassphrase'), | 338 | 'retrieveKeyFunction': MochiKit.Base.method(this, 'getPassphrase'), |
342 | 'remoteData': { | 339 | 'remoteData': { |
343 | 'data': someServerData['header'], | 340 | 'data': someServerData['header'], |
344 | 'version': someServerData['version'], | 341 | 'version': someServerData['version'], |
345 | 'recordsStats': someServerData['recordsStats'] | 342 | 'recordsStats': someServerData['recordsStats'] |
346 | }, | 343 | }, |
347 | // 'encryptedDataKeypath': 'data', | 344 | // 'encryptedDataKeypath': 'data', |
348 | // 'encryptedVersionKeypath': 'version', | 345 | // 'encryptedVersionKeypath': 'version', |
349 | 'retrieveRecordDetailFunction':MochiKit.Base.method(this, 'getRecordDetail') | 346 | 'retrieveRecordDetailFunction':MochiKit.Base.method(this, 'getRecordDetail') |
350 | }); | 347 | }); |
351 | 348 | ||
352 | recordsIndex = legacyHeader; | 349 | recordsIndex = legacyHeader; |
353 | preferences = legacyHeader; | 350 | preferences = legacyHeader; |
354 | oneTimePasswords= legacyHeader; | 351 | oneTimePasswords= legacyHeader; |
355 | break; | 352 | break; |
356 | case '0.1': | 353 | case '0.1': |
357 | varheaderData; | 354 | varheaderData; |
358 | 355 | ||
359 | headerData = Clipperz.Base.evalJSON(someServerData['header']); | 356 | headerData = Clipperz.Base.evalJSON(someServerData['header']); |
360 | 357 | ||
361 | recordsIndex = new Clipperz.PM.DataModel.User.Header.RecordIndex({ | 358 | recordsIndex = new Clipperz.PM.DataModel.User.Header.RecordIndex({ |
362 | 'retrieveKeyFunction': MochiKit.Base.method(this, 'getPassphrase'), | 359 | 'retrieveKeyFunction': MochiKit.Base.method(this, 'getPassphrase'), |
363 | 'recordsData': headerData['records'], | 360 | 'recordsData': headerData['records'], |
364 | 'recordsStats': someServerData['recordsStats'], | 361 | 'recordsStats': someServerData['recordsStats'], |
365 | 'directLoginsData': headerData['directLogins'], | 362 | 'directLoginsData': headerData['directLogins'], |
366 | 'encryptedDataVersion': someServerData['version'], | 363 | 'encryptedDataVersion': someServerData['version'], |
367 | 'retrieveRecordDetailFunction':MochiKit.Base.method(this, 'getRecordDetail') | 364 | 'retrieveRecordDetailFunction':MochiKit.Base.method(this, 'getRecordDetail') |
368 | }); | 365 | }); |
369 | 366 | ||
370 | //Still missing a test case that actually fais with the old version of the code, where the check for undefined was missing | 367 | //Still missing a test case that actually fais with the old version of the code, where the check for undefined was missing |
371 | if (typeof(headerData['preferences']) != 'undefined') { | 368 | if (typeof(headerData['preferences']) != 'undefined') { |
372 | preferences= new Clipperz.PM.DataModel.User.Header.Preferences({ | 369 | preferences= new Clipperz.PM.DataModel.User.Header.Preferences({ |
373 | 'name':'preferences', | 370 | 'name':'preferences', |
374 | 'retrieveKeyFunction': MochiKit.Base.method(this, 'getPassphrase'), | 371 | 'retrieveKeyFunction': MochiKit.Base.method(this, 'getPassphrase'), |
375 | 'remoteData': { | 372 | 'remoteData': { |
376 | 'data': headerData['preferences']['data'], | 373 | 'data': headerData['preferences']['data'], |
377 | 'version': someServerData['version'] | 374 | 'version': someServerData['version'] |
378 | } | 375 | } |
379 | }); | 376 | }); |
380 | } else { | 377 | } else { |
381 | preferences= new Clipperz.PM.DataModel.User.Header.Preferences({ | 378 | preferences= new Clipperz.PM.DataModel.User.Header.Preferences({ |
382 | 'name':'preferences', | 379 | 'name':'preferences', |
383 | 'retrieveKeyFunction': MochiKit.Base.method(this, 'getPassphrase') | 380 | 'retrieveKeyFunction': MochiKit.Base.method(this, 'getPassphrase') |
384 | }); | 381 | }); |
385 | } | 382 | } |
386 | 383 | ||
387 | if (typeof(headerData['oneTimePasswords']) != 'undefined') { | 384 | if (typeof(headerData['oneTimePasswords']) != 'undefined') { |
388 | oneTimePasswords = new Clipperz.PM.DataModel.User.Header.OneTimePasswords({ | 385 | oneTimePasswords = new Clipperz.PM.DataModel.User.Header.OneTimePasswords({ |
389 | 'name':'preferences', | 386 | 'name':'preferences', |
390 | 'retrieveKeyFunction': MochiKit.Base.method(this, 'getPassphrase'), | 387 | 'retrieveKeyFunction': MochiKit.Base.method(this, 'getPassphrase'), |
391 | 'remoteData': { | 388 | 'remoteData': { |
392 | 'data': headerData['oneTimePasswords']['data'], | 389 | 'data': headerData['oneTimePasswords']['data'], |
393 | 'version': someServerData['version'] | 390 | 'version': someServerData['version'] |
394 | } | 391 | } |
395 | }); | 392 | }); |
396 | } else { | 393 | } else { |
397 | oneTimePasswords = new Clipperz.PM.DataModel.User.Header.OneTimePasswords({ | 394 | oneTimePasswords = new Clipperz.PM.DataModel.User.Header.OneTimePasswords({ |
398 | 'name':'preferences', | 395 | 'name':'preferences', |
399 | 'retrieveKeyFunction': MochiKit.Base.method(this, 'getPassphrase') | 396 | 'retrieveKeyFunction': MochiKit.Base.method(this, 'getPassphrase') |
400 | }); | 397 | }); |
401 | } | 398 | } |
402 | 399 | ||
403 | break; | 400 | break; |
404 | } | 401 | } |
405 | 402 | ||
406 | unpackedData = { | 403 | unpackedData = { |
407 | 'version': someServerData['version'], | 404 | 'version': someServerData['version'], |
408 | 'statistics': someServerData['statistics'], | 405 | 'statistics': someServerData['statistics'], |
409 | 'header': { | 406 | 'header': { |
410 | 'data': someServerData['header'], | 407 | 'data': someServerData['header'], |
411 | 'version': headerVersion, | 408 | 'version': headerVersion, |
412 | 409 | ||
413 | 'recordsIndex': recordsIndex, | 410 | 'recordsIndex': recordsIndex, |
414 | 'preferences': preferences, | 411 | 'preferences': preferences, |
415 | 'oneTimePasswords': oneTimePasswords | 412 | 'oneTimePasswords': oneTimePasswords |
416 | } | 413 | } |
417 | }; | 414 | }; |
418 | 415 | ||
419 | this._serverData = unpackedData; | 416 | this._serverData = unpackedData; |
420 | //console.log("<<< ***************** user.unpackServerData", this._serverData); | ||
421 | 417 | ||
422 | return this._serverData; | 418 | return this._serverData; |
423 | }, | 419 | }, |
424 | 420 | ||
425 | //------------------------------------------------------------------------- | 421 | //------------------------------------------------------------------------- |
426 | 422 | ||
427 | 'getServerData': function() { | 423 | 'getServerData': function() { |
428 | var deferredResult; | 424 | var deferredResult; |
429 | 425 | ||
430 | deferredResult = new Clipperz.Async.Deferred("User.getServerData", {trace:false}); | 426 | deferredResult = new Clipperz.Async.Deferred("User.getServerData", {trace:false}); |
431 | deferredResult.acquireLock(this.deferredLockForSection('serverData')); | 427 | deferredResult.acquireLock(this.deferredLockForSection('serverData')); |
432 | deferredResult.addCallback(MochiKit.Base.bind(function(aResult) { | 428 | deferredResult.addCallback(MochiKit.Base.bind(function(aResult) { |
433 | var innerDeferredResult; | 429 | var innerDeferredResult; |
434 | 430 | ||
435 | innerDeferredResult = new Clipperz.Async.Deferred("User.getUserDetails.innerDeferred", {trace:false}); | 431 | innerDeferredResult = new Clipperz.Async.Deferred("User.getUserDetails.innerDeferred", {trace:false}); |
436 | if (this._serverData == null) { | 432 | if (this._serverData == null) { |
437 | innerDeferredResult.addCallbackPass(MochiKit.Signal.signal, this, 'loadingUserDetails'); | 433 | innerDeferredResult.addCallbackPass(MochiKit.Signal.signal, this, 'loadingUserDetails'); |
438 | innerDeferredResult.addMethod(this.connection(), 'message', 'getUserDetails'); | 434 | innerDeferredResult.addMethod(this.connection(), 'message', 'getUserDetails'); |
439 | innerDeferredResult.addMethod(this, 'unpackServerData'); | 435 | innerDeferredResult.addMethod(this, 'unpackServerData'); |
440 | innerDeferredResult.addCallbackPass(MochiKit.Signal.signal, this, 'loadedUserDetails'); | 436 | innerDeferredResult.addCallbackPass(MochiKit.Signal.signal, this, 'loadedUserDetails'); |
441 | } | 437 | } |
442 | 438 | ||
443 | innerDeferredResult.addCallback(MochiKit.Base.bind(function () { | 439 | innerDeferredResult.addCallback(MochiKit.Base.bind(function () { |
444 | return this._serverData; | 440 | return this._serverData; |
445 | },this)); | 441 | },this)); |
446 | innerDeferredResult.callback(); | 442 | innerDeferredResult.callback(); |
447 | 443 | ||
448 | return innerDeferredResult; | 444 | return innerDeferredResult; |
449 | }, this)); | 445 | }, this)); |
450 | deferredResult.releaseLock(this.deferredLockForSection('serverData')); | 446 | deferredResult.releaseLock(this.deferredLockForSection('serverData')); |
451 | deferredResult.callback(); | 447 | deferredResult.callback(); |
452 | 448 | ||
453 | return deferredResult; | 449 | return deferredResult; |
454 | }, | 450 | }, |
455 | 451 | ||
456 | //------------------------------------------------------------------------- | 452 | //------------------------------------------------------------------------- |
457 | 453 | ||
458 | 'connectionVersion': function() { | 454 | 'connectionVersion': function() { |
459 | return this._connectionVersion; | 455 | return this._connectionVersion; |
460 | }, | 456 | }, |
461 | 457 | ||
462 | 'setConnectionVersion': function(aValue) { | 458 | 'setConnectionVersion': function(aValue) { |
463 | if (this._connectionVersion != aValue) { | 459 | if (this._connectionVersion != aValue) { |
464 | this.resetConnection(); | 460 | this.resetConnection(); |
465 | } | 461 | } |
466 | this._connectionVersion = aValue; | 462 | this._connectionVersion = aValue; |
467 | }, | 463 | }, |
468 | 464 | ||
469 | //------------------------------------------------------------------------- | 465 | //------------------------------------------------------------------------- |
470 | 466 | ||
471 | 'connection': function() { | 467 | 'connection': function() { |
472 | if ((this._connection == null) && (this.connectionVersion() != null) ){ | 468 | if ((this._connection == null) && (this.connectionVersion() != null) ){ |
473 | this._connection = new Clipperz.PM.Connection.communicationProtocol.versions[this.connectionVersion()]({ | 469 | this._connection = new Clipperz.PM.Connection.communicationProtocol.versions[this.connectionVersion()]({ |
474 | getCredentialsFunction: MochiKit.Base.method(this, 'getCredentials') | 470 | getCredentialsFunction: MochiKit.Base.method(this, 'getCredentials') |
475 | }); | 471 | }); |
476 | } | 472 | } |
477 | 473 | ||
478 | return this._connection; | 474 | return this._connection; |
479 | }, | 475 | }, |
480 | 476 | ||
481 | 'resetConnection': function(aValue) { | 477 | 'resetConnection': function(aValue) { |
482 | if (this._connection != null) { | 478 | if (this._connection != null) { |
483 | this._connection.reset(); | 479 | this._connection.reset(); |
484 | } | 480 | } |