-
Notifications
You must be signed in to change notification settings - Fork 16
/
loginWith..st
45 lines (45 loc) · 2.07 KB
/
loginWith..st
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
login/logout
loginWith: aSessionDescription
| todeServerCreationString jsonString resultArray todeServerOop transcriptOopType authorId |
self sessionDescription: aSessionDescription.
session := (GsDevKitSession new sessionDescription: aSessionDescription) session.
session clientObj: self.
[ todeServerCreationString := self todeServerCreationStringWithOptions: true.
jsonString := self session executeString: todeServerCreationString ]
on: TDErrorNotification
do: [ :ex |
self
error:
'Unable to log into server:' , ex description , 'with: '
, todeServerCreationString printString ].
resultArray := self objectSerializer fromString: jsonString.
todeServerOop := resultArray at: 1.
todeClientOopType := (resultArray at: 3) gciResultToGsOopType: self session.
todeServerOopType := todeServerOop gciResultToGsOopType: self session.
(resultArray at: 2)
ifNotNil: [ :transcriptOop |
transcriptOopType := transcriptOop gciResultToGsOopType: self session.
self session registerClientObjectForwarderOopType: transcriptOopType for: Transcript ].
self session registerClientObjectForwarderOopType: todeClientOopType for: self.
resultArray size > 3
ifTrue: [ | protocolSignature objSerializer serverApiVersionString |
protocolSignature := resultArray at: 4.
objSerializer := TodeObjectSerializer serializeUsing: protocolSignature.
self session
send: #serializeObjectsUsing:version:
to: todeServerOopType
withArgs: objSerializer protocolSignatureArray.
self objectSerializer: objSerializer.
serverApiVersionString := resultArray size > 4
ifTrue: [ resultArray at: 5 ]
ifFalse: [ '1.0.0' ].
self serverApiVersion: serverApiVersionString asMetacelloVersionNumber ].
authorId := self sessionDescription authorId.
authorId isEmpty
ifTrue: [ authorId := Author fullName ].
self session send: #authorInitials: to: todeServerOopType withArgs: {authorId}.
self effectiveApiVersion >= '1.3.0' asMetacelloVersionNumber
ifTrue: [ self session
send: #effectiveApiVersion:
to: todeServerOopType
withArgs: {self effectiveApiVersion asString} ]