Check-in [8f5ba435cf]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix key import through chat
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 8f5ba435cf67f9d4be8cca5b55d94a28f2c8b495
User & Date: bernd 2020-01-31 21:58:14.466
Context
2020-01-31
23:24
More fixes check-in: 1a894f33cb user: bernd tags: trunk
21:58
Fix key import through chat check-in: 8f5ba435cf user: bernd tags: trunk
19:35
Get keys from peers check-in: 38e2425029 user: bernd tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to keys.fs.
134
135
136
137
138
139
140









141
142
143
144
145
146
147

Variable sim-nick!

: nick! ( -- ) sim-nick! @ ?EXIT  o { w^ optr }
    ke-nick $@ nick# #@ d0= IF
	optr cell ke-nick $@ nick# #! 0
    ELSE









	last# cell+ $@len cell/
	optr cell last# cell+ $+!
    THEN  ke-nick# ! ;

: #.nick ( hash -- )
    dup $@ type '#' emit cell+ $@len cell/ . ;








>
>
>
>
>
>
>
>
>







134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156

Variable sim-nick!

: nick! ( -- ) sim-nick! @ ?EXIT  o { w^ optr }
    ke-nick $@ nick# #@ d0= IF
	optr cell ke-nick $@ nick# #! 0
    ELSE
	last# cell+ $@ bounds DO
	    ke-pk $@ I @ .ke-pk $@ str= IF
		I @ .ke-nick# @ ke-nick# !
		I @ .ke-offset 64@ ke-offset 64!
		I @ .ke-selfsig $@ drop 64@ ke-selfsig $@ drop 64@ 64u<
		IF  optr @ I !  THEN
		UNLOOP  EXIT
	    THEN
	cell +LOOP
	last# cell+ $@len cell/
	optr cell last# cell+ $+!
    THEN  ke-nick# ! ;

: #.nick ( hash -- )
    dup $@ type '#' emit cell+ $@len cell/ . ;

157
158
159
160
161
162
163

164



165
166
167
168
169
170
171
    THEN  ke-pets[] $[]# 1- ke-pets# $[] ! ;

: key:new ( addr u -- o )
    \G create new key, addr u is the public key
    sample-key >o  ke-sk ke-end over - erase
    key-entry-table @ token-table !
    >storekey @ ke-storekey !

    key-read-offset 64@ ke-offset 64!



    1 import-type @ lshift [ 1 import#new lshift ]L or ke-imports !
    keypack-all# n>64 key-read-offset 64+!
    o cell- ke-end over - 2over key| key# #!
    o>
    current-key ;

0 Value last-key







>
|
>
>
>







166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
    THEN  ke-pets[] $[]# 1- ke-pets# $[] ! ;

: key:new ( addr u -- o )
    \G create new key, addr u is the public key
    sample-key >o  ke-sk ke-end over - erase
    key-entry-table @ token-table !
    >storekey @ ke-storekey !
    2dup key| key# #@ d0= IF
	key-read-offset
    ELSE
	last# cell+ $@ drop cell+ .ke-offset
    THEN   64@ ke-offset 64!
    1 import-type @ lshift [ 1 import#new lshift ]L or ke-imports !
    keypack-all# n>64 key-read-offset 64+!
    o cell- ke-end over - 2over key| key# #!
    o>
    current-key ;

0 Value last-key
Changes to msg.fs.
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
    msg-group-o >o msg:peers[] $[]# 0 ?DO
	I msg:peers[] $[] @ .fetch-pks
    LOOP o> ;
: msg-tredisplay ( n -- )
    reset-time
    msg-group-o >o msg:?otr msg:-otr o> >r
    [: cells >r msg-log@ { log u } u r> - 0 max { u' }
      log u u' /string ?scan-pks  ?fetch-pks
      log u' ?search-lock
      log u u' /string bounds ?DO
	  I log - cell/ to log#
	  I $@ { d: msgt }
	  msgt ['] msg:display catch IF  ." invalid entry" cr
	      2drop  THEN
      cell +LOOP







|







1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
    msg-group-o >o msg:peers[] $[]# 0 ?DO
	I msg:peers[] $[] @ .fetch-pks
    LOOP o> ;
: msg-tredisplay ( n -- )
    reset-time
    msg-group-o >o msg:?otr msg:-otr o> >r
    [: cells >r msg-log@ { log u } u r> - 0 max { u' }
      log u ?scan-pks  ?fetch-pks
      log u' ?search-lock
      log u u' /string bounds ?DO
	  I log - cell/ to log#
	  I $@ { d: msgt }
	  msgt ['] msg:display catch IF  ." invalid entry" cr
	      2drop  THEN
      cell +LOOP